| Gap | Between | Merit |
|---|
Prime gap explorer
The primes thin out as numbers grow, but not evenly: 89 and 97 are 8 apart, 1,327 and 1,361 are 34 apart, while twin primes such as 101 and 103 sit side by side. Choose any range up to 2 trillion and every gap is plotted at its prime, next to the average gap ln p and Cramér's bound (ln p)². Count the twin primes, see how often each gap size occurs, open any gap to see the composite numbers that fill it, and jump to the largest gaps ever found. Enter a range with From and To: up to 10 million numbers wide, anywhere below 2 trillion. Each dot is the gap from a prime to the next one; point at it, or tab to the chart and use the arrow keys, to read it, and click it (or press Enter) to show its numbers below, with the smallest factor of each. Previous and Next walk through the gaps. Histogram shows how often each gap occurs; click a bar to show its first gap. Record gap jumps to one of the largest gaps known, and the table lists the record gaps of your range.
How it works
- Enter a range with From and To, or pick a record gap to jump to it. The gaps up to 100,000 are shown first.
- Point at a dot to read its gap, and click it to see the numbers in that gap with the smallest factor of each.
- Switch to Histogram to see how often each gap occurs, and use the table of record gaps to step through the largest ones.
How far apart are the primes?
By the prime number theorem, the chance that a number near p is prime is about 1 in ln p, so the average gap between primes near p is about ln p: about 7 near 1,000, about 14 near a million and about 28 near a trillion. The gaps themselves jump around that average. Below 100,000 there are 9,592 primes and 1,224 pairs of twin primes, and the largest gap is 72, after 31,397. Turn on ln p and (ln p)² to see how the dots spread between and above the two curves.
Record gaps and Cramér's conjecture
A maximal gap is larger than every gap before it: 34 after 1,327, 72 after 31,397, 114 after 492,113, and 582 after 1,346,294,310,749. In 1936 Harald Cramér suggested that the largest gaps grow no faster than (ln p)², and every gap found since has stayed below that curve. Merit measures a gap against the average: the gap divided by ln p. The gap of 34 after 1,327 has a merit of 4.73, almost five times the usual spacing.
Frequently asked questions
What is a prime gap?
The difference between a prime and the next prime. The gap after 23 is 6, because the next prime is 29, and the five numbers in between, 24 to 28, are all composite. Apart from the gap of 1 between 2 and 3, every gap is even.
Can prime gaps be as large as you like?
Yes. For any n, the numbers n! + 2, n! + 3, up to n! + n are all composite, because n! + k is divisible by k. That is n − 1 composites in a row, so there is a gap of at least n. But by Bertrand's postulate there is always a prime between n and 2n, so the gap after a prime p is always smaller than p.
What are twin primes?
Two primes with a gap of 2, such as 11 and 13 or 101 and 103. Nobody knows whether there are infinitely many. In 2013 Yitang Zhang proved that some gap below 70 million occurs infinitely often, and later work brought that bound down to 246.
Which gap is the most common?
From 947 on, a gap of 6 occurs more often than any other, because a gap of 6 avoids the multiples of both 2 and 3. The histogram colors the multiples of 6, which stand out above their neighbours. Much further out, the most common gap is expected to become 30, then 210.
How far can the explorer go?
Any range up to 10 million numbers wide that ends below 2 trillion. The primes are found with a segmented sieve of Eratosthenes in your browser, usually in a fraction of a second, and nothing is sent anywhere.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Go to Editor