← All projects / The Gaps Between Primes

The gaps between primes, in base 2 and base 5

Ten is 2 × 5, so if primes are a "2 and 5 thing" it ought to show in the gaps between them when those gaps are written in base 2 and base 5. Here are all the gaps up to ten million. The 2 and the 5 are both there. So are 3, 7, 11 and 13, each leaving exactly the same kind of mark.

First, the loop

exact

Yes: the 2s, 3s, 5s, 7s, 11s and 13s are just the primes

The oldest way to find primes is to cross out the multiples of 2, then of 3, then of 5, and so on. The numbers you cross out with are the primes themselves. Nothing else is needed and nothing else works.

exact

That is the loop

Cross out the multiples of 2. The first number left standing is 3, so 3 is prime, and now you cross out with 3. The first number left after that is 5, so you cross out with 5. Each prime you find becomes the tool for finding the next. To get the primes you already need the primes.

exact

Why it matters

Every pattern on this site that narrows down the primes is a piece of that loop: the 6n ± 1 wheel is the 2 and the 3, the 60-hour clock is five more small primes, a bigger wheel is a few more again. None of them steps outside the loop, which is why none of them ever finishes the job.

The gaps, written three ways

PrimeNext primeGapGap in base 2Gap in base 5

The gap at any number

In base 2

The gap ends inShare of all gapsIf it were a coin toss
proved

Every gap after the first ends in 0

Past 2, every prime is odd, so the gap between two of them is even. In base 2 an even number ends in 0. That is the whole of what the 2 does: it forces one zero on the end.

measured

A single zero is a little too common

In base 5

Last base 5 digit of the gapShare of all gapsThe smallest gaps of that kind
measured

Ending in 0 is the rarest, not the commonest

measured

But it is catching up

The mark every prime leaves

Here are the commonest gaps. The bars are uneven, but the unevenness has a rule: a gap that is a multiple of 3 turns up twice as often as its neighbours, a multiple of 5 one and a third times as often, a multiple of 7 one and a fifth. Divide each count by its boost and what is left falls away smoothly.

multiple of 3multiple of 5 but not 3neither

GapBase 2Base 5How manyBoostCount ÷ boost
measured

The rule for the boost

For a prime p the boost is p − 1 divided by p − 2. So 3 gives 2, 5 gives 4/3, 7 gives 6/5, 11 gives 10/9. It comes from the loop: a gap that is a multiple of p can never push the next number onto a multiple of p, so p never gets to veto it.

measured

3 is the loudest, not 5

So is it a 2 and 5 thing?

In the digits, yes

In the primes themselves, no more than any other prime

The 2 makes every gap even. The 5 makes gaps that are multiples of 5 a third more common than they'd otherwise be. But 3 does the same thing more strongly, and 7, 11 and 13 do it more weakly. 2 and 5 only look special because they are the two primes ten is made of.

The 0101s hold only 5, and the 1010s only 2

That is true and it has a plain cause. Every 1010 number is even, so 2 is the only one that can be prime. Every 0101 number past 5 splits into two smaller factors, which is proved. That the two survivors are 2 and 5 is a neat accident: in binary they are 10 and 101, the two shortest numbers of each pattern.