E049: Wieferich primes (base 2): scan and quotient visualization

Preview figure for E049
Preview figure for E049

Tags: number-theory, counterexample-search, visualization, wieferich See: Valid Tags.

Highlights

  • Scans primes up to a bound for the Wieferich condition \(2^{p-1}\equiv 1\ (\mathrm{mod}\ p^2)\).

  • Recovers the known small hits (1093 and 3511) under default settings.

  • Visualizes a quotient-like value that is exactly zero for Wieferich primes.

Goal

Explore a rare strengthening of Fermat’s congruence and visualize how exceptional Wieferich primes are.

Background (quick refresher)

Research question

Up to a bound \(B\), which primes satisfy the Wieferich condition (base 2), and how does the quotient-like statistic vary across primes?

Experiment design

  • Generate all primes \(p\le B\) (excluding \(p=2\) for base 2).

  • Compute \(r = 2^{p-1} \bmod p^2\) and derive \(q = (r-1)/p\ (\mathrm{mod}\ p)\).

  • Mark primes with \(q=0\) as Wieferich hits.

  • Plot hit positions and a scatter of \(q\) values.

Reproducibility

  • params.json records the run settings.

  • report.md summarizes the key findings.

  • figures/*.png contains the plots for the run.

Interpreting the results

  • Hits at 1093 and 3511 confirm the implementation.

  • The quotient scatter is purely exploratory; it’s a compact way to see “how far” a prime is from the Wieferich condition.

  • Increasing the bound quickly becomes compute-heavy (but remains feasible for moderate bounds in pure Python).

Published run snapshot

If this experiment is included in the docs gallery, include the published snapshot (report + params).

Parameters

  • p_max: 200000

  • base: 2

Hits

Wieferich primes found within the scan bound:

1093, 3511

Notes

  • For base 2, the smallest known Wieferich primes are 1093 and 3511.

  • The scan here is purely computational and bounded.

params.json (snapshot)
{
  "base": 2,
  "p_max": 200000
}

References

See Wieferich [1909], The OEIS Foundation Inc. [2025], Wikipedia contributors [2025].