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
Subtract each prime from the next: 3 − 2 = 1, then 2, 2, 4, 2, 4, 2, 4, and on. The gap 2 gives twin primes. 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 conjecture 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.
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
| Gap | Times it occurs | Share of all gaps |
|---|---|---|
| 1 | 1 | 4.2% |
| 2 | 8 | 33.3% |
| 4 | 7 | 29.2% |
| 6 | 7 | 29.2% |
| 8 | 1 | 4.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
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.
- 2next prime 3: gap 13The only odd gap: 2 is the one even prime.
- 3next prime 5: gap 25A twin-prime pair, 3 and 5.
- 5next prime 7: gap 27A second twin pair, so the gap 2 now leads with two.
- 7next prime 11: gap 411The first gap of 4, because 9 = 3 × 3 is not prime.
- 11next prime 13: gap 213The third twin pair.
- 13next prime 17: gap 417The second gap of 4. The gap 2 still leads, three to two.
- 17next prime 19: gap 219The fourth twin pair.
- 19next prime 23: gap 423The third gap of 4.
- 23next prime 29: gap 629The first gap of 6, the one that leads from the prime 947 onwards.
What you are seeing
A tally of differences, and a tallest bar that is not the shortest gap
List the primes 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 limit and draws one bar per gap.
The tallest bar is called the jumping champion. Gap 2 might be your first guess if you have heard of twin primes 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.
Why it starts to make sense
How multiples of 3 favour some gaps
Take the residues modulo 3. A prime p above 3 leaves a remainder 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 conjecture, and it is a heuristic. The page counts the result and does not prove it.
The key idea
More room, but more to avoid
The same bookkeeping works for every small prime. 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 factor, 6 has the factor 3, 30 has 3 and 5, and 210 has 3, 5 and 7: the primorials, each one the product of the primes up to some point.
Against that, a gap of g between consecutive primes needs every number in between to be composite, 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 factors is predicted to win, one primorial 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.
Formal statement
The prediction, and the order of the primorials
For an even , the Hardy–Littlewood conjecture predicts that the number of for which and are both prime is
where is the twin prime 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 primes. Heuristically, a fraction 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 primorial, , each one taking over from the last at a very large threshold.
What is proved, and by whom
A table, a theorem about big gaps, and two conjectures
Three kinds of statement are in play and the claim ledger keeps them apart.
We compute exact integer tallies with a segmented sieve and check them against trial division at several limits. We also check the largest gaps below ten million and a hundred million. The displayed tallies describe only primes below ten million.
That there are arbitrarily large gaps is a theorem, and the proof fits in a line: for any , the numbers are all composite, because is divisible by .
The proposed changes to 30 and then 210 come from Odlyzko, Rubinstein and Wolf’s heuristic using a quantitative form of the Hardy–Littlewood conjecture. Whether the twin-prime gap 2 occurs infinitely often is also open.
Limits and further questions
Where the page stops looking
The champion view ends at ten million. For every prime from 947 onwards up to that edge, 6 leads. That is a fact about the range counted. The conjecture predicts that 30 eventually overtakes 6.
The largest gap below ten million is 154, after the prime 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 twin primes are infinite, how large the first gap of 30 overtaking 6 is, and whether the conjectured primorial 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.
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
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
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
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
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
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.
- 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.
- 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.
- 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.
Related explorations
(connected by how they work)