Working notes on the primes

Grant Golland’s working notes on how the prime numbers are spread out. Every figure is computed here from a sieve of all 5 761 455 primes below 100 000 000, or with mpmath, and its caption says how. A sibling site, Zeta Zeros, covers the zeros that control these patterns.

Sentences carry a flag: Settled for proved theorems or computations on a stated range, Open for conjectures. A numerical match is never a proof.

Step 6

Gaps between primes

By the Prime Number Theorem, the average gap near x is about log x. But gaps vary wildly: some are 2, and some are many times the average.

Bar heights: number of gaps of each even size 2..100 between consecutive primes from 10^7 to 10^8 (log vertical scale). The light curve is the exponential fit a geometric/Cramér model predicts with mean gap 17.66. Gaps of 6, 12, 18, 30 stand out: multiples of 6 are favoured, which the random model misses.
Sieve: numpy boolean sieve of Eratosthenes to 108, 23 October 2026 PT, giving π(108) = 5 761 455 (matches the standard value). 5 096 876 gaps between consecutive primes above 107. Mean gap 17.66. There are 668 765 gaps of 6 against 381 332 of 2 and 381 636 of 4. Motion is off if your system asks for reduced motion.

A simple random model, in which each n is prime with chance 1/log n, predicts a smooth exponential decline. The real counts follow it on average, but multiples of 6 are strongly favoured, because p and p + 6 dodge divisibility by 2 and 3 together. The Hardy–Littlewood conjectures on the next page predict exactly these preferences.

Record gaps

Each dot is a maximal gap: a gap after prime p larger than every gap before it. 25 records up to 10^8, the last a gap of 220 after 47326693. Curve: (log p)^2, Cramér's 1936 heuristic scale. Log x axis.
All 25 maximal gaps below 108, from the sieve, ending with 220 after 47 326 693. These agree with the published table of maximal gaps (Oliveira e Silva, Herzog and Pardi 2014, verified to 4 × 1018). Motion is off if your system asks for reduced motion.
  • Open Cramér (1936) used the random model to conjecture that the largest gap near x is about (log x)². Granville (1995) argued that the true maxima are somewhat larger, by about a factor 2e−γ ≈ 1.12, because of the same small-divisor effects. Both are heuristics.
  • Settled The largest maximal gap known with certainty below 264 is 1550, following 18 361 375 334 787 046 697 (found 2018, part of a search verified to 264). Quoted from the published records, not recomputed here.
  • Settled Rankin, Ford–Green–Konyagin–Tao and Maynard (2014–2018): there are infinitely many gaps larger than a constant times log x · log log x · log log log log x / log log log x, beating the average.

Bounded gaps

  • Settled Yitang Zhang (Annals of Mathematics, 2014; announced 2013): there are infinitely many pairs of primes that differ by less than 70 000 000. This was the first finite bound.
  • Settled James Maynard (Annals, 2015) and, independently, Terence Tao found a simpler method giving 600, and more: for any m, infinitely many intervals of bounded length contain m primes.
  • Settled The Polymath 8 project (Research in the Mathematical Sciences, 2014) lowered the bound to 246. It still stands.
  • Open Getting from 246 to 2 is the twin prime conjecture. Even assuming the strongest standard distribution conjecture (Elliott–Halberstam in generalized form), the method reaches 6, not 2.

Reading path · step 7 of 11