Skip to content
Number Buffet

Prime gaps

The distances between consecutive primes: 1, 2, 2, 4, 2, 4, 2, 4, 6 — including the record-setting gaps.

OEIS A001223 · 3 min read

Settings

Quick presets

A gap is the difference between one prime and the next, so n gaps need n+1 primes.

The first gap listed is the one beginning at the smallest prime at or above this number.

Large gaps are rare: nothing bigger than 154 occurs below ten million, so a high threshold may find nothing inside the range one request sieves.

Fine-tune the look

Pick a preset next to the image first — these controls adjust it.

Frame

A border drawn inside the edge of the image.

Advanced

Results

30 values

1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, 14

Largest gap here: 14, the run of composites after 113. Average gap across these 30 steps: 4.17. Near x the average runs at about ln x. The leading 1, from 2 to 3, is the only odd gap there is: every prime after 2 is odd, so every later gap is even.


Make an image

Turn on JavaScript to style and download these numbers as an image. The values themselves are listed above.

Text on the image

Drag a line straight onto the picture to place it — once placed, it stays exactly where you put it. Everything here is drawn into the download.

About prime gaps

Gaps were studied long before they were named. Joseph Bertrand's postulate of 1845 — that a prime always lies between n and 2n — is a statement about gaps, and Chebyshev proved it in 1852. The sharpest general tool arrived with the prime number theorem in 1896: the average gap near x is about ln x. That average says nothing whatsoever about any particular gap.

The extremes have been the interesting part. Erik Westzynthius proved in 1931 that gaps can be arbitrarily larger than the average, so the ratio g/ln p is unbounded. Erdős in 1935 and Rankin in 1938 sharpened that into a bound which then stood for more than seventy years; Erdős offered one of his cash prizes for improving Rankin's constant, and the problem finally fell in 2014 to two independent teams — Kevin Ford, Ben Green, Sergei Konyagin and Terence Tao on one side, James Maynard on the other.

From the other direction, Harald Cramér conjectured in 1936 that the gap following p is at most roughly (ln p)², which is far smaller than anything anyone has proved. The record for small gaps moved in April 2013, when Yitang Zhang showed that some gap below 70 million recurs infinitely often — the first finite bound of its kind. Maynard, Tao and the Polymath collaboration cut it to 246 within the year.

Record gaps have been tabulated, first by hand and later by machine, since the nineteenth century. The maximal gaps — each one larger than every gap before it — run 1, 2, 4, 6, 8, 14, 18, 20, 22, 34 and onwards, and there is no record gap of 10, 12 or 16. Gaps of those sizes certainly occur (139 to 149 is a gap of 10), but by the time they first appear a larger gap has already been seen. As of May 2026 the largest maximal gap known is 1,854, following the prime 101,412,319,996,363,309,069, found by Robert Smith using code by Brian Kehrig. It is only the 85th such record, and the list is conjectured to grow about as fast as 2 ln n.

Key properties

  • The gap from 2 to 3 is 1 — the only odd gap. Every prime after 2 is odd, so every later gap is even.
  • The gaps between the first primes are 1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, …
  • Gaps of 2, 4 and 6 have names of their own: twin primes, cousin primes and sexy primes.
  • Two gaps of 2 occur back to back only at 3, 5, 7, because any three odd numbers two apart include a multiple of 3.
  • Gaps are arbitrarily large: n!+2, n!+3, …, n!+n are all composite, which forces a gap of at least n somewhere.
  • The average gap near x is about ln x, a consequence of the prime number theorem. Near one billion that average is close to 21.
  • The record (maximal) gaps are 1, 2, 4, 6, 8, 14, 18, 20, 22, 34, 36, 44, 52, 72, 86, 96, 112, 114, 118, 132, 148, 154, … — the last of those occurring after 4,652,353.
  • The first gap of 100 or more is the gap of 112 that follows 370,261.

Where they turn up

  • Cryptographic key generation picks a random odd number and tests successive candidates until one is prime, so the gap structure sets the cost: roughly 350 odd candidates on average for each 1024-bit factor of a 2048-bit RSA key.
  • Gapcoin was a cryptocurrency whose proof of work was the search for prime gaps of high merit; its network found the first gap with merit above 40, in 2017.
  • The merit of a gap — its size divided by ln p — is how record hunters compare gaps found at wildly different scales. The largest merit on record as of 2026 is 42.5192, found by Mario Vojvoda.
  • Gap searches double as stress tests for distributed computing and for big-integer libraries: the largest known gap between two proven primes runs to 1,113,106, between numbers of 18,662 digits.

How to use this generator

The generated values appear at the top, with a copy button beside them. To turn them into an image, pick a look from the style presets under Make an image, choose an export size, and download as PNG, JPEG or WebP. Everything is rendered in your browser, so nothing you generate is sent to a server.

The address bar updates as you work, so the link always reproduces exactly what you see — handy for sharing a specific sequence or saving a configuration for later. Use Copy to take the values as plain text, or Export data for CSV, JSON, NDJSON, SQL or XML.

Sources

Historical summaries on this page draw on the openly licensed references listed above. Spotted an error? Tell us and we will fix it.