Distance Between Primes

Prime Gap Calculator

Calculate the exact distance between back-to-back prime numbers. Find the biggest gaps, discover prime deserts (long stretches of composite numbers), and see how gaps grow.

Quick Ranges:
Biggest Gap 14
Smallest Gap 1
Average Gap 4.38
Total Gaps Found 45
List of Prime Gaps Distance between neighboring primes
Prime Pair Gap Distance Gap Name
01

1. Prime Leap Visualizer: Jumping to the Next Prime

Click any prime number below to watch the jump to the next prime, measure the distance, and see all the composite numbers skipped along the way:

From Prime: 2 To Next Prime: 3
2
Gap = 1
3
Composite Numbers Skipped in Between:
None (Consecutive integers)
02

2. How Unusually Big Is a Prime Gap? (Merit Calculator)

Because primes get further apart as numbers grow, mathematicians use a score called Merit to see if a gap is unusually wide. A merit of 1 is normal, while a merit above 5 is unusually big, and above 10 is a rare record. Test any prime and gap size below:

Famous Records:
Natural Log ln(p) 4.727
Merit Ratio 2.961
Cramér Ratio 0.626
Expected Gap 22.3
A merit of 2.961 means this prime gap is nearly 3 times larger than the average prime spacing at this size.
03

3. Record-Breaking Prime Gaps Table

Historical record-breaking prime gaps that set new distance records when discovered. Click any row to test it in the calculator above:

First Prime Second Prime Gap Distance Merit Score Cramér Score Milestone Try It
2 3 1 1.443 2.081 Only Odd Gap
3 5 2 1.820 1.657 Twin Prime
7 11 4 2.056 1.056 Cousin Prime
23 29 6 1.914 0.610 Sexy Prime
89 97 8 1.782 0.397 Sub-100 Champion
113 127 14 2.961 0.626 First Double-Digit Gap
523 541 18 2.875 0.459 Sub-1000 Landmark
887 907 20 2.946 0.434 Sub-1000 Champion
1,129 1,151 22 3.129 0.445 Merit > 3 Milestone
1,327 1,361 34 4.728 0.658 4-Merit Milestone
9,551 9,587 36 3.928 0.429 Sub-10,000 Champion
15,683 15,727 44 4.555 0.472 Historical Record
19,609 19,661 52 5.261 0.532 Merit > 5 Milestone
31,397 31,469 72 6.954 0.672 Sub-50,000 Champion
155,921 156,007 86 7.192 0.602 Sub-200,000 Record
360,653 360,767 114 8.908 0.696 First Triple-Digit Gap
370,261 370,373 112 8.736 0.681 Twin Desert
492,113 492,227 114 8.697 0.663 Sub-500,000 Champion
1,349,533 1,349,681 148 10.485 0.743 First Merit > 10 Champion
2,010,733 2,010,881 148 10.198 0.703 2M Landmark
04

4. Four Clear Walkthroughs

Four examples showing how prime gaps form, why composites clump together, and how merit is calculated:

Walkthrough 1: 2 to 3 Gap = 1

Distance: 3 - 2 = 1.

Why it's special: 2 is the only even prime; 3 is odd. Since all other primes are odd, and odd minus odd is always even, this is the only odd prime gap in the entire universe of numbers!

Skipped numbers: Zero composite numbers skipped.

Walkthrough 2: 89 to 97 Gap = 8

Skipped composites: 7 consecutive composite numbers in a row: 90, 91, 92, 93, 94, 95, 96.

Why they are composite: 90 is even, 91 = 7 × 13, 92 is even, 93 = 3 × 31, 94 is even, 95 = 5 × 19, 96 is even.

Record: This is the widest prime desert under 100.

Walkthrough 3: 113 to 127 Gap = 14

Milestone: The very first double-digit prime gap in mathematics.

Skipped composites: 13 composite numbers in a row (114 through 126).

Merit score: 14 / ln(113) ≈ 2.96 (nearly three times wider than the average gap around 100).

Walkthrough 4: 1,349,533 to 1,349,681 Gap = 148

Historical record: The first prime gap ever found with a merit score over 10.

Calculations: Distance is 148. Merit score = 148 / 14.115 = 10.485.

Desert size: 147 composite numbers in an unbroken row with zero primes.

05

5. How to Make a Prime Desert of Any Length (The Factorial Trick)

Can prime gaps be as large as 1,000,000? Yes! A simple mathematical proof shows that you can create an unbroken run of composite numbers as long as you want using factorials:

(k + 1)! + 2,   (k + 1)! + 3,   …,   (k + 1)! + (k + 1)
k = 4
Prime density and widening gap intervals diagram
Why Average Gaps Grow Like ln(x) Although factorial constructions produce prime deserts of arbitrary length, typical gaps scale gently with natural logarithm ln(x).

Related Sequence Calculators

Frequently Asked Questions

What is a prime gap?

A prime gap is simply the distance between two neighboring prime numbers. For example, between consecutive primes 7 and 11, the gap is 11 - 7 = 4. This gap skips three composite numbers in between: 8, 9, and 10.

Why is the gap between 2 and 3 the only odd prime gap?

The difference between 2 and 3 is 3 - 2 = 1. Because 2 is the only even prime number, all primes after 2 are odd numbers. When you subtract an odd number from another odd number, the answer is always even. That means every single prime gap after 3 is an even number (2, 4, 6, 8, and so on).

What is the largest prime gap under 100?

Between 1 and 100, the largest prime gap is 8, occurring between 89 and 97 (97 - 89 = 8). It skips 7 composite numbers in a row: 90, 91, 92, 93, 94, 95, and 96.

Can prime gaps be as large as you want?

Yes, you can have prime gaps of any size you want—even a million or a billion composite numbers long! Mathematicians call these long stretches with no primes 'prime deserts'. Using factorials, you can easily create an unbroken chain of consecutive composite numbers of any length.

Why are prime gaps of 6 more common than gaps of 2 or 4?

Every prime number greater than 3 is either 1 above or 1 below a multiple of 6 (like 5 and 7, or 11 and 13). Adding 6 shifts you to another number with the exact same remainder without forcing it to divide by 3. This makes gaps of 6 much more frequent than gaps of 2 or 4.

What does the merit of a prime gap mean?

Merit measures how unusually large a prime gap is compared to the average gap size around that number. An average gap has a merit of 1. If a gap has a merit of 3, it is three times wider than normal. Gaps with a merit above 10 are extremely rare record-holders.

What did Yitang Zhang prove about prime gaps?

For centuries, mathematicians wondered if prime gaps keep getting wider forever or if primes continue to land close together. In 2013, mathematician Yitang Zhang made a historic breakthrough by proving that prime numbers keep landing within 70 million of each other forever. Other mathematicians later narrowed this gap down to just 246.

What is Cramér's prediction about prime gaps?

In 1936, Swedish mathematician Harald Cramér predicted that the biggest prime gap near any number roughly matches the square of its natural logarithm (ln p)². While still unproven, modern computer searches have checked up to trillions and found that actual gaps fit this prediction well.