The Distribution of Primes
The primes are infinite,
but they grow scarcer as you climb. Among the first ten numbers, four are prime; among ten
numbers near a million, usually only one is. Is there any order to this thinning, or are the
primes scattered at random? Remarkably, there is a precise law — one of the most beautiful in
mathematics.
Counting the primes: \pi(x)
Write \pi(x) for the number of primes up to
x. So \pi(10) = 4 (namely
2, 3, 5, 7) and \pi(100) = 25. It is a
staircase that jumps by one at every prime and is flat in between. Watch how its rising shape is
shadowed almost exactly by a smooth curve:
The smooth curve: x / \ln x
Gauss, as a teenager, noticed that \pi(x) is tracked closely by
x / \ln x. Equivalently, the density of primes near a large
number x is about 1/\ln x — so a number
near x has roughly a 1 / \ln x chance of
being prime. This is the celebrated
Prime Number Theorem:
\pi(x) \sim \frac{x}{\ln x} \qquad\text{(the ratio} \to 1 \text{ as } x \to \infty).
Proving it took a century after Gauss's guess and required the deep machinery of
complex analysis —
we will return to it in the analytic stage.
Gaps, twins, and stubborn mysteries
The average behaviour is law-like, but the local behaviour is wild. There are arbitrarily long
runs with no primes at all (the numbers
n! + 2, n! + 3, \dots, n! + n are all composite). Yet primes also
keep clustering as close as possible — twin primes like
(11, 13) and (101, 103) differing by
2. Whether there are infinitely many twin primes is still
unknown — a simple-sounding question that has resisted every assault for centuries.