Consecutive prime numbers are prime numbers that appear next to each other in the ordered list of primes. The difference between them is called a prime gap. For example, 11 and 13 are consecutive primes, and their prime gap is 2.
Definition
Two prime numbers are consecutive primes when there is no other prime number between them. If the smaller prime is written as pn and the next prime is written as pn+1, the prime gap measures the distance from one to the next.
Prime Gap Formula
gn = pn+1 − pn
Here, pn is one prime, pn+1 is the next prime after it, and gn is the gap between them.
What Consecutive Prime Numbers Mean
Prime numbers are whole numbers greater than 1 with exactly two positive divisors: 1 and the number itself. When the primes are listed in order, each neighboring pair forms a pair of consecutive primes.
The beginning of the prime sequence is:
- 2
- 3
- 5
- 7
- 11
- 13
- 17
- 19
- 23
- 29
In this list, 5 and 7 are consecutive primes because no prime number lies between them. But 7 and 13 are not consecutive primes, because 11 appears between them.
What Prime Gaps Measure
A prime gap measures the numerical distance between two consecutive primes. It does not count how many primes are missing. It measures subtraction.
Example Pair
17 and 19 are consecutive primes.
Gap
19 − 17 = 2
Between Them
Only 18 lies between them, and 18 is composite.
If two consecutive primes have a gap of 6, then five whole numbers lie between them. Since the primes are consecutive, every whole number between them is not prime.
Small Table of Consecutive Primes and Gaps
The first few prime gaps show a pattern that becomes useful when studying prime distribution.
| Consecutive Prime Pair | Calculation | Prime Gap | Numbers Between |
|---|---|---|---|
| 2 and 3 | 3 − 2 | 1 | None |
| 3 and 5 | 5 − 3 | 2 | 4 |
| 5 and 7 | 7 − 5 | 2 | 6 |
| 7 and 11 | 11 − 7 | 4 | 8, 9, 10 |
| 11 and 13 | 13 − 11 | 2 | 12 |
| 23 and 29 | 29 − 23 | 6 | 24, 25, 26, 27, 28 |
Why Most Prime Gaps Are Even
The first prime gap is 1, between 2 and 3. After that, every prime number is odd, because 2 is the only even prime number.
The difference between two odd numbers is always even. That is why every prime gap after 2 and 3 is an even number.
Math Note
After the pair 2 and 3, prime gaps can be 2, 4, 6, 8, 10, and so on. A gap of 2 gives a twin prime pair, such as 17 and 19 or 29 and 31.
Prime Gaps and Composite Numbers Between Primes
A prime gap is closely related to composite numbers. If p and q are consecutive primes and q − p = d, then the whole numbers between them are not prime.
For a gap of d, there are d − 1 whole numbers strictly between the two primes. For example, the gap from 23 to 29 is 6, and the five numbers between them are 24, 25, 26, 27, and 28.
Common Mistake
A prime gap of 6 does not mean there are six composite numbers between the primes. It means the difference between the two consecutive primes is 6. The count of numbers between them is one less than the gap.
Prime Gaps Do Not Predict the Next Prime Exactly
Prime numbers become less dense on average as numbers grow, but this does not give an exact rule for the next prime. A long gap can appear after a smaller gap, and a small gap can appear after a larger one.
Some filters narrow down possible prime candidates. For example, every prime greater than 3 can be written as 6n − 1 or 6n + 1. But many numbers in those forms are still composite, such as 25, 35, and 49.
Candidate vs Prime
A number can look like a possible prime and still fail a primality test. Candidate rules reduce the numbers worth checking; they do not prove primality.
Checking Numbers Near a Prime Gap
When comparing nearby primes, it can help to test the numbers around the gap. You can use PrimeOrNot’s prime number checker to test a number for primality before comparing it with the next or previous prime.
Check a Number Directly
Enter a whole number and compare the result with nearby numbers to see how prime gaps appear in a local range.
Test a Number Around a Prime Gap
Enter a whole number and check whether it is prime before comparing it with nearby primes.
Related Concepts
FAQ About Consecutive Primes and Prime Gaps
What are consecutive prime numbers?
Consecutive prime numbers are prime numbers that appear next to each other in the ordered list of primes. There is no other prime number between them.
What is a prime gap?
A prime gap is the difference between two consecutive prime numbers. If the primes are 23 and 29, the prime gap is 29 − 23 = 6.
What is the first prime gap?
The first prime gap is 1, between 2 and 3. This is the only odd prime gap between consecutive primes.
Why are prime gaps usually even?
After 2, all prime numbers are odd. The difference between two odd numbers is even, so every prime gap after 2 and 3 is even.
Does a prime gap count the composite numbers between primes?
No. A prime gap is a subtraction result. If two consecutive primes have a gap of d, then d − 1 whole numbers lie between them.
Can prime gaps get larger?
Yes. Prime gaps can become large. Prime numbers thin out on average as numbers grow, but nearby primes can still appear close together.