MathomalyA field guide to patterns, proofs and open questions

ExplorationsTwin primes are famous, but is the gap 2 really the commonest between consecutive primes?

The Gap That Wins the Count

Known as Prime gaps and jumping champions

Conjecturedprimesprime gapstwin primesintermediate

Subtract each from the next: 3 − 2 = 1, then 2, 2, 4, 2, 4, 2, 4, and on. The gap 2 gives . Is it the commonest gap? Count every prime below a million and see whether the guess holds. The commonest gap changes as the range grows, and a says it will change again, far beyond anything counted.

Interactive laboratory

Current view: Every gap, counted

Count how often each gap between consecutive primes occurs.

Every gap, counted · to 100commonest 2
04826the gap between consecutive primes

The commonest gap is 2, occurring 8 times out of 24 gaps (33.3%). The twin-prime gap 2 occurs 8 times (33.3%). Every gap after the first (2 to 3) is even, because two odd primes differ by an even number.

Every gap as a table
GapTimes it occursShare of all gaps
114.2%
2833.3%
4729.2%
6729.2%
814.2%
red bar
the commonest gap, the jumping champion (each of them, if tied)
blue bar
any other gap

One bar per gap, from the smallest to the largest that occurs. The height is how many times that gap occurs among the primes up to the limit. The red bar is the commonest gap, the jumping champion, or each of them if tied. The gap 2 is the twin primes, and every gap after the first is even.

Every prime up to 100 counted. The commonest gap is 2, occurring 8 times out of 24 gaps (33.3%). The twin-prime gap 2 occurs 8 times (33.3%).

Range
2 to 100
Primes
25
Commonest gap
2
Twin gaps
8
Largest gap
8
Lead last changed
at 7

Things to try

Things to try with this figure
  • the gap
  • What breaks it. The commonest gap in one range of primes is the commonest gap in a bigger range. Try: You follow the first thousand. The twin-prime gap 2 leads at first, then 4, then 6, so a champion read off a small range says little about a bigger one.

  • Before opening the view, guess which gap is the commonest below a thousand, and which below a million. Then compare the two.

    Hint

    Open the champion view at a thousand and at a million and read the red line at the right-hand edge of each.

  • Where does the twin-prime gap 2 rank among all gaps at ten million? Count the bars taller than it.

    Hint

    Read the table under the counts view, sorted by eye by the second column, at ten million.

  • Among the commonest gaps at ten million, what do 6, 12 and 18 have in common that 2 and 4 do not?

    Hint

    Divide each by 3. The page explains why a multiple of 3 is favoured.

  • In the records view, how much larger is the largest gap than the one before it, and how far apart are the last few records?

    Hint

    Read the table: the starting primes of the last records are much farther apart than the first ones.

How this page is laid out

How far to count

Twenty-five primes. The twin-prime gap 2 is ahead, and every count is small enough to check by hand.

Every prime in the range is sieved and every gap counted exactly, in your browser, in a fraction of a second. The page stops at ten million; what happens beyond that is cited, never counted.

Cases worth seeing

What is going on

Each explanation begins with a worked example and follows the same operation through intuition, formal statements and proofs. Later sections distinguish what is established from questions that remain open, so you can follow the level of detail useful to you.

Worked by handThe first gaps between consecutive , starting at 2. Each row adds one to a single tally in the laboratory.
  1. 2next prime 3: gap 13The only odd gap: 2 is the one even .
  2. 3next prime 5: gap 25A twin- pair, 3 and 5.
  3. 5next prime 7: gap 27A second twin pair, so the gap 2 now leads with two.
  4. 7next prime 11: gap 411The first gap of 4, because 9 = 3 × 3 is not .
  5. 11next prime 13: gap 213The third twin pair.
  6. 13next prime 17: gap 417The second gap of 4. The gap 2 still leads, three to two.
  7. 17next prime 19: gap 219The fourth twin pair.
  8. 19next prime 23: gap 423The third gap of 4.
  9. 23next prime 29: gap 629The first gap of 6, the one that leads from the 947 onwards.
The laboratory does exactly this for every below ten million and keeps the tally of each gap. The counts view draws the tallies as bars, and the champion view follows which one is ahead as the range grows.
After nine gaps the twin- 2 is ahead, and it is natural to expect it to stay ahead. It does not: it is overtaken by 4 and then by 6, and from the 947 onwards, through every prime below ten million, the gap 6 is the commonest.
01

What you are seeing

A tally of differences, and a tallest bar that is not the shortest gap

List the in order and subtract each from the next: 2 to 3 is 1, 3 to 5 is 2, 7 to 11 is 4, 23 to 29 is 6. After the first, every gap is even, because two odd primes differ by an even number. Mathomaly counts how often each gap occurs among the primes up to your chosen and draws one bar per gap.

The tallest bar is called the . Gap 2 might be your first guess if you have heard of such as 11 and 13. Below a million the champion is 6, which occurs 13,549 times, against 8,169 for 2, 8,143 for 4 and 8,005 for 12. Below ten million the order of the first four is 6, 12, 2 and 4: 99,987, 65,513, 58,980 and 58,621.

02

Why it starts to make sense

How multiples of 3 favour some gaps

Take the 3. A p above 3 leaves a of 1 or 2. For a twin pair p, p + 2 the remainder of p must be 2: if it were 1, then p + 2 would be a multiple of 3. So the gap 2 can only start from one of the two residues. A pair p, p + 6 has the same remainder at both ends, and either residue is allowed. Mod 3 alone, the gap 6 has twice the room that the gap 2 has, and the gap 12 has twice the room that the gap 4 has.

This is the idea behind the , and it is a . The page counts the result and does not prove it.

03

The key idea

More room, but more to avoid

The same bookkeeping works for every small . A gap g is easier to hit when g is a multiple of small odd primes, because then those primes block fewer starting points. The gap 2 has no odd prime , 6 has the factor 3, 30 has 3 and 5, and 210 has 3, 5 and 7: the , each one the product of the primes up to some point.

Against that, a gap of g between consecutive needs every number in between to be , and that is a bigger ask the larger g is. Primes thin out as the range grows, so the ask gets easier with range. Short gaps win early, when primes are dense and long gaps are rare. As the range grows the extra room for gaps with more small prime is predicted to win, one after another.

The prediction concerns numbers a long way past anything counted, and the claim ledger says so: the champion 6 is measured, the champions 30 and 210 are conjectured.

04

Formal statement

The prediction, and the order of the

For an even , the – predicts that the number of for which and are both is

where is the constant. The product is the room described above: it is 1 for and , 2 for and , and larger for and . Not every such pair is a gap between consecutive . Heuristically, a of about of them have no prime between them, and that fraction grows with .

Odlyzko, Rubinstein and Wolf worked out the consequences. They conjectured that for large enough ranges the champion is a , , each one taking over from the last at a very large threshold.

05

What is proved, and by whom

A table, a about big gaps, and two

Three kinds of statement are in play and the claim ledger keeps them apart.

We compute exact tallies with a segmented sieve and check them against at several . We also check the largest gaps below ten million and a hundred million. The displayed tallies describe only below ten million.

That there are arbitrarily large gaps is a , and the fits in a line: for any , the numbers are all , because is divisible by .

The proposed changes to 30 and then 210 come from Odlyzko, Rubinstein and Wolf’s using a quantitative form of the – . Whether the twin- 2 occurs infinitely often is also open.

06

Limits and further questions

Where the page stops looking

The champion view ends at ten million. For every from 947 onwards up to that , 6 leads. That is a fact about the range counted. The predicts that 30 eventually overtakes 6.

The largest gap below ten million is 154, after the 4,652,353. The record under a hundred million is 220, after 47,326,693; we cite that record and independently recount it in our tests. The records get sparser but do not stop: there are gaps as large as one likes, and this page cannot say where the next one falls.

Open questions the page leaves alone: whether the are infinite, how large the first gap of 30 overtaking 6 is, and whether the conjectured pattern is right.

What is actually established

Every statement on this page, with its status, its exact scope, and the date that status was last checked.

Exhaustively checked

Below a million there are 78,498 primes and the gap 6 occurs 13,549 times, against 8,169 for 2, 8,143 for 4 and 8,005 for 12. Below ten million there are 664,579 primes and the gap 6 occurs 99,987 times, against 65,513 for 12, 58,980 for 2 and 58,621 for 4.

Scope
Every prime up to 1,000,000 and up to 10,000,000, counted exactly, with the gap defined as the difference between consecutive primes. The counts say nothing about primes above ten million.
Why
The kernel sieves in segments and adds one to a tally for each gap. A second implementation, written from the definition by trial division, agrees with it in every tally at ten limits up to 30,000, and the number of primes counted at a million and at ten million is the known 78,498 and 664,579.
Computation (exact)
All 664,579 primes up to 10,000,000 by segmented sieve of Eratosthenes, with each gap between consecutive primes added to a tally keyed by its size. Algorithm primeGaps.gapsTo v1.
Status checked
Exhaustively checked

Counting primes up to x, the commonest gap is 6 for every x from the prime 947 to 10,000,000. Before that the lead changes hands 26 times, among 1, 2, 4 and 6.

Scope
Every limit from the prime 947 up to 10,000,000, tracked prime by prime in one pass. The 27 sets of champions, ties included, are listed in the champion view’s table. Nothing is claimed for x above ten million.
Why
The leader is tracked as each gap is counted, so every change is seen and not sampled at checkpoints. The last change is at the prime 947, where 6 takes the sole lead from a tie with 4. It then stays the sole commonest gap through the end of the range, with 12 second at ten million, at about two thirds of its count.
Computation (exact)
The set of commonest gaps after each of the 664,579 primes up to 10,000,000, from one pass of the segmented sieve, recorded whenever the set changes. Algorithm primeGaps.gapsTo v1.
Status checked
Exhaustively checked

The twin-prime gap 2 occurs 8 times among the primes up to 100, 35 up to a thousand, 205 up to ten thousand, 1,224 up to a hundred thousand, 8,169 up to a million and 58,980 up to ten million.

Scope
Each power of ten from 100 to 10,000,000, counted exactly. That the twin-prime gap occurs infinitely often is the twin prime conjecture, and is open.
Why
Twin primes keep turning up at every scale counted, but their share of all gaps falls, from a third at a hundred to under a tenth at ten million.
Computation (exact)
The tally of the gap 2 at each power of ten, from one pass of the segmented sieve to 10,000,000. Algorithm primeGaps.gapsTo v1.
Status checked
Exhaustively checked

Below ten million the gap sets a new record 22 times, the largest being 154, from the prime 4,652,353. Below a hundred million the largest gap is 220, from 47,326,693.

Scope
The ten-million figure is counted by the page, from a sieve to ten million. The hundred-million figure is cited from the table of record gaps and recounted from a sieve in the tests; the page itself does not count that far.
Why
The next record after 220 is 222, from 122,164,747, beyond a hundred million.
Computation (exact)
The running maximum of the gap between consecutive primes, over every prime up to 10,000,000 in the page, and up to 100,000,000 in the tests. Algorithm primeGaps.gapsTo v1.
Status checked
Proved

For every n there is a gap between consecutive primes of at least n.

Scope
All n. The proof is on the page.
Why
The n − 1 numbers n! + 2, n! + 3, ..., n! + n are all composite, since n! + k is divisible by k, so the next prime after the one below them is at least n away.
Status checked
Conjectured

The commonest gap between consecutive primes below x is conjectured to change from 6 to 30 and then to 210, and onwards through the primorials, at astronomically large values of x.

Scope
Odlyzko, Rubinstein and Wolf propose this sequence using a quantitative Hardy–Littlewood heuristic. The laboratory stops at ten million, far below the predicted first change.
Why
The conjectured count of prime pairs at distance g has a factor that grows with the odd primes dividing g. Against that, the chance that no prime lies between the two ends falls as g grows, but less steeply as the range grows. So larger gaps with more small prime factors are predicted to overtake, one primorial after another.
Status checked

Sources

Review notes show which bibliographic details Mathomaly has checked and which remain unresolved. Checking a publication record does not independently verify its proof.

I’ve checked each citation below against the publication itself, unless it says otherwise. That checks the reference, not the proof.

  1. Andrew Odlyzko, Michael Rubinstein, Marek Wolf, Jumping champions, Experimental Mathematics 8(2), pp. 107–118, 1999. Link

    The authors credit John Conway for the term “jumping champion” and use a quantitative Hardy–Littlewood heuristic to predict changes from 6 to 30 and then 210. The laboratory computes counts up to ten million.

    Bibliographic review:

    AI-assisted source review. Evidence type: source text.

    The introduction and first table verify the reported early champions and the conjecture. The proposed changes to 30 and 210 are heuristic predictions.

  2. G. H. Hardy, J. E. Littlewood, Some problems of “Partitio numerorum”; III: On the expression of a number as a sum of primes, Acta Mathematica 44, pp. 1–70, 1923. Link

    The prime k-tuples conjecture includes a prediction for the count of prime pairs at a fixed distance. The constant depends on the odd prime factors of the distance, and the prediction motivates the jumping-champion heuristic.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    The DOI registry record confirms the authors, the title, Acta Mathematica volume 44, pages 1–70 and 1923. The paper text was not read, so that the k-tuples conjecture appears in it is the standard attribution and is not confirmed here.

  3. A005250: Record gaps between primes, The On-Line Encyclopedia of Integer Sequences. Link

    Cited with companion entry A002386 for the record gap of 220 starting at 47,326,693 and the next record of 222 starting at 122,164,747. The tests independently recount the largest gap below a hundred million.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    The OEIS entries A005250 and A002386 were read on this date and confirm both record sizes and their starting primes. The tests independently recalculate the records below ten million and a hundred million from a sieve.

(connected by how they work)