Prime Gap Calculator

Primes

largest prime gap up to 1008
the gap is between the primes89 and 97
record-breaking gaps up to 1005
primes up to 10025
How this was calculated
  1. Sieve all 25 primes up to 100 and subtract each prime from the next to get every prime gap.
  2. The largest gap in range is 8, between the consecutive primes 89 and 97.
  3. A record gap is one bigger than every gap before it; 5 records occur up to 100.
  4. Prime gaps grow only logarithmically on average - the average gap near 100 is about ln(100) = 4.6 - but record gaps keep creeping up faster than the average.

A prime gap is the distance between two consecutive primes. This calculator finds that distance for the numbers you enter and shows you the answer directly, so you can see how far apart two neighboring primes sit. To make the idea concrete, the largest prime gap up to 100 is 8, between 89 and 97; up to 1,000 it is 20, between 887 and 907; and up to 10,000 it is 36, between 9,551 and 9,587. A record, or maximal, gap is one larger than every gap before it: 5 records occur up to 100, 8 up to 1,000 and 11 up to 10,000. Average gaps grow like ln(n), about 9.2 near 10,000, but record gaps grow faster than the average.

The method behind the calculator is the accepted standard for this kind of calculation because it follows the definition of a prime gap directly: it identifies consecutive primes and measures the distance between them, which is exactly how the gaps above are counted. Prime gaps are where the prime number theorem's smooth average meets the primes' local irregularity, so careful counting is what keeps results trustworthy. This page shows the formula used, step-by-step workings, worked examples and sources, so you can check every result yourself rather than take it on trust.

Worked examples

Largest prime gap up to 100

(100)

largest prime gap up to 1008
the gap is between the primes89 and 97
record-breaking gaps up to 1005
primes up to 10025

Largest prime gap up to 1,000

(1000)

largest prime gap up to 1,00020
the gap is between the primes887 and 907
record-breaking gaps up to 1,0008
primes up to 1,000168

Largest prime gap up to 10,000

(10000)

largest prime gap up to 10,00036
the gap is between the primes9,551 and 9,587
record-breaking gaps up to 10,00011
primes up to 10,0001,229

What is a prime gap?

A prime gap is the distance between two consecutive primes — that is, the number of steps you count from one prime to the next prime with no primes in between. Because the primes thin out as you move up the number line, these gaps are not uniform: some are small, some are large, and the pattern of sizes is one of the most studied features of the primes.

Take a concrete example. The primes 89 and 97 are consecutive — there is no prime between them — so the prime gap from 89 to 97 is 8. That gap of 8 happens to be the largest gap found anywhere up to 100. The record does not hold for long, though. Up to 1,000 the largest gap is 20, between 887 and 907, and up to 10,000 it is 36, between 9,551 and 9,587. Each of these is a single stretch of composite numbers sitting between two neighboring primes.

Not every large gap is a record. A record (maximal) gap is one larger than every gap before it. By that stricter definition there are 5 records up to 100, 8 up to 1,000, and 11 up to 10,000. So most gaps you encounter are ordinary; only a handful set a new high mark as you climb.

Two different behaviors are at work. Average gaps grow like ln(n) — the natural logarithm of n — which is about 9.2 near 10,000. Record gaps, however, grow faster than the average, which is why the biggest gap below 10,000 (36) sits well above the typical gap of roughly 9. In this sense prime gaps are exactly where the prime number theorem's smooth average meets the primes' local irregularity: the average describes the general trend, while individual gaps jump above and below it in ways that are hard to predict.

Use the calculator to find the gap between any two consecutive primes, check whether a gap sets a new record, and compare a specific gap against the average for its size.

Running example: 89 and 97 are consecutive primes, so the prime gap between them is 8 — the largest gap up to 100.

Largest gaps at three limits

The size of a prime gap depends on how far out you look. Small numbers can only produce small gaps, so the largest gap found below a given limit climbs as the limit rises. The table below shows the largest prime gap and the two primes that bracket it at three limits: 100, 1,000, and 10,000.

Up to 100, the largest prime gap is 8, running from 89 to 97. Up to 1,000, it is 20, between 887 and 907. Up to 10,000, it is 36, between 9,551 and 9,587. Each of these is a record gap — a gap larger than every gap before it. There are 5 such records up to 100, 8 up to 1,000, and 11 up to 10,000. So the record count rises slowly even as the record size itself grows.

It helps to separate a record gap from a typical one. The average gap grows like ln(n), which is about 9.2 near 10,000. A gap of 36 is therefore far above what an average stretch between consecutive primes looks like at that height. Record gaps grow faster than the average, which is why the largest gap at 10,000 is several times the typical spacing there.

This is where the prime number theorem meets the primes' local irregularity. The theorem describes a smooth average spacing, but the actual primes are unevenly spread, and a prime gap is exactly the point where those two pictures meet. The calculator lets you check any range: enter a limit and see the gaps between consecutive primes, the largest one, and how it compares with the average.

LimitLargest prime gapPrime pair
100889 to 97
1,00020887 to 907
10,000369,551 to 9,587
Record gaps outrun the average: near 10,000 the typical gap is about 9.2, while the largest gap up to that limit is 36.

Record-breaking gaps

Not every large prime gap is a record. A record (maximal) gap is one larger than every gap before it, so it marks a new high point in the sequence of gaps between consecutive primes. As you move up the number line, most gaps are ordinary — but a few set new records, and counting them shows how rare those records become. Up to 100 there are 5 records; up to 1,000 there are 8; and up to 10,000 there are 11.

The jump from 5 records to 8 records between 100 and 1,000, and then to only 11 by 10,000, shows that new records get harder to find as the numbers grow. Each record must beat every gap that came before it, so the bar keeps rising. That is why the record count climbs slowly even as the range expands by a factor of ten each time.

It helps to compare record gaps with the typical gap. Average gaps grow like ln(n) — about 9.2 near 10,000 — but record gaps grow faster than the average. So the records pull away from the typical spacing between primes, even though most individual gaps stay close to the average. This is where the prime gap sits at the meeting point between the prime number theorem's smooth average and the primes' local irregularity: the average is predictable, but the records are not.

The three limits make the pattern concrete. Up to 100, the largest prime gap is 8, between 89 and 97. Up to 1,000, it is 20, between 887 and 907. Up to 10,000, it is 36, between 9,551 and 9,587. Each of these is a record at its limit, and each is larger than the one before — which is exactly what a maximal gap requires.

  • Up to 100: 5 records; largest gap is 8, between 89 and 97.
  • Up to 1,000: 8 records; largest gap is 20, between 887 and 907.
  • Up to 10,000: 11 records; largest gap is 36, between 9,551 and 9,587.
  • Average gaps grow like ln(n) — about 9.2 near 10,000 — but record gaps grow faster than the average.
A record gap must be larger than every gap before it — so the count rises slowly: 5 records up to 100, 8 up to 1,000, and 11 up to 10,000.

How gaps grow

The average prime gap grows very slowly, but the largest gaps grow faster. That contrast is the heart of how gaps grow. The prime number theorem gives a smooth estimate of how many primes there are below a number n, and from that estimate the average distance between consecutive primes near n is about ln(n), the natural logarithm of n. Near 10,000, ln(n) is about 9.2, so on average consecutive primes around that height sit roughly nine numbers apart. That average is only a trend: actual prime gaps jump around it, because the primes themselves are irregular locally.

The averages are easy to see in the record data. Up to 100, the largest prime gap is 8, between 89 and 97. Up to 1,000 it is 20, between 887 and 907. Up to 10,000 it is 36, between 9,551 and 9,587. Each of these is a record (maximal) gap: a gap larger than every gap before it. There are 5 records up to 100, 8 up to 1,000 and 11 up to 10,000. Notice how few records there are even as the range grows tenfold — record gaps are rare events, but each one is a step above everything that came before.

The record gaps climb faster than the average. While the typical prime gap near 10,000 is around 9.2, the record gap in that range is 36 — roughly four times the average. That is the pattern the guidance points to: average gaps grow like ln(n), but record gaps grow faster than the average. The average is pulled along by the smooth count of primes; the records are set by the rare stretches where the primes happen to leave a wide empty interval.

This is where the prime number theorem meets the primes' local irregularity. The theorem supplies a smooth average, and the prime gaps are the places where that smooth average runs into the actual, uneven spacing of the primes. The result is that gaps of any size eventually occur: however large a gap you name, somewhere among the primes there will be a run of consecutive composite numbers long enough to produce it. The records up to 100, 1,000 and 10,000 are simply the first few milestones on that endless climb.

Average gap near 10,000: about 9.2. Record gap up to 10,000: 36, between 9,551 and 9,587.

FAQs

What is a prime gap?

A prime gap is the difference between two consecutive prime numbers. In other words, it is the distance you count from one prime to the next prime that follows it, with no other primes in between. For example, the gap from 89 to 97 is 8, because 97 minus 89 equals 8.

What is the largest prime gap below 100?

The largest prime gap below 100 is 8. It occurs between the consecutive primes 89 and 97. No other pair of consecutive primes under 100 is separated by more than 8, which makes this the biggest gap in that range.

What is the largest prime gap below 1,000?

The largest prime gap below 1,000 is 20. It occurs between 887 and 907, which are consecutive primes. That means no two consecutive primes under 1,000 are separated by more than 20, so this gap is the largest one in that range.

What is a record prime gap?

A record prime gap is a gap strictly larger than every prime gap that occurs before it. It is also called a maximal gap. So as you move through the primes in order, a gap only counts as a record if it beats every gap seen earlier, not just the one right before it.

How many record prime gaps are there below 10,000?

There are 11 record prime gaps below 10,000. The last of these is the record gap of 36 between 9,551 and 9,587. Each of the 11 gaps is strictly larger than every prime gap that occurs before it, which is what makes it a record, or maximal, gap.

How big is a typical prime gap near 10,000?

A typical prime gap near 10,000 is about ln(10,000), which is roughly 9.2. By comparison, the record gap of 36 near that range is about four times the average. So most gaps around 10,000 are near 9, while the record stands out as unusually large.

Sources

Related calculators

Prime Counting Calculator
Exact count of primes up to any limit of ten million or less by the sieve of Eratosthenes, compared with the prime number theorem estimate x / ln(x), the average prime gap and the count in the top half of the range.
Nth Prime Calculator
Find the nth prime number exactly: a sieve of Eratosthenes sized by Rosser's theorem bound returns prime number n for any n up to 10,000, with the previous and next primes and the prime gap that follows it.
Cousin Prime Calculator
Count cousin prime pairs - primes differing by 4 - up to a limit by sieve, with the largest pair in range and the twin-prime count at the same limit for comparison.