The Cramér Model
The primes refuse to reveal a formula. So in 1936 the Swedish mathematician
Harald Cramér tried a wonderfully cheeky move: if the primes behave like a
random set, why not just model them as one and see what the randomness predicts? Toss a
biased coin for every integer, keep the ones that come up "prime", and study the resulting fake
primes. The astonishing payoff is that this crude cartoon reproduces almost everything we know about
real primes — the counting function, the typical gap, even a razor-sharp guess for the
largest gap — and it does so from a single line of probability.
It is also a cautionary tale. The model is a heuristic, not a theorem, and precisely where
it is most confident — the fine structure of primes in short intervals — reality quietly breaks its
promise. This page builds the model, cashes out its predictions, and then shows the two famous places
it goes wrong.
The model in one line
Recall from
the distribution of primes
that a number near x is prime with density about
1/\ln x. Cramér turns that density into an actual
probability and declares each integer's primality an independent coin toss.
-
Let X_3, X_4, X_5, \dots be independent random
variables, one for each integer n \ge 3.
-
Each X_n equals 1 ("n
is prime") with probability \dfrac{1}{\ln n}, and
0 otherwise.
-
The random set \mathcal{P} = \{\, n : X_n = 1 \,\} is the model's
stand-in for the primes. Any statistic of the real primes is predicted by the same
statistic computed for \mathcal{P}.
That is the whole engine. It knows nothing about divisibility, factorisation, or the number
2 — it only knows a coin that grows steadily fairer to land on "composite"
as n grows. Everything below is just a consequence of that one assumption.
Prediction 1: the count is \operatorname{Li}(x)
How many model-primes are there up to x? By linearity of expectation, the
expected count is just the sum of the individual probabilities:
\mathbb{E}\big[\pi_{\mathrm{model}}(x)\big] = \sum_{n=3}^{x} \frac{1}{\ln n} \approx \int_2^x \frac{dt}{\ln t} = \operatorname{Li}(x).
The model doesn't merely reproduce the crude estimate x/\ln x — it lands
directly on the logarithmic integral
\operatorname{Li}(x), which is the best smooth approximation to
\pi(x) and the true main term of the
Prime Number Theorem.
A one-line probability calculation recovers a theorem that took a century and complex analysis to
prove. That is why number theorists take the cartoon seriously.
Prediction 2: the typical gap is \ln p_n
Fix a model-prime near x. The next integer is prime with probability
\approx 1/\ln x, the one after that independently the same, and so on — a
geometric wait. The expected number of tosses until the next success is the reciprocal of the success
probability:
\mathbb{E}[\text{gap after } p] \approx \frac{1}{1/\ln p} = \ln p.
So the model predicts a typical gap of \ln p_n after the
n-th prime — exactly the average spacing the real primes obey. It goes
further: a geometric wait means the gaps should be exponentially distributed, so a
gap of size \lambda \ln p should occur with relative frequency about
e^{-\lambda}. Plotting real prime gaps against
e^{-\lambda} gives a strikingly good fit — the primes really do look, at
this level of detail, like a random exponential process.
Prediction 3: the maximal gap is (\ln x)^2
Here is where the model earns its fame. Typical gaps are \ln p, but how big
is the largest gap you should expect to see among all primes up to
x? In a run of about x/\ln x independent
geometric waits, the longest run of consecutive "composite" tosses is, by an extreme-value estimate,
about (\ln x) times the typical gap. Carefully done, the expected maximal
gap comes out as (\ln x)^2. This is Cramér's conjecture.
-
Writing p_n for the n-th prime and
g_n = p_{n+1} - p_n for the gap that follows it,
-
\limsup_{n\to\infty} \frac{g_n}{(\ln p_n)^2} = 1.
-
Equivalently, the maximal gap among primes up to x grows like
(\ln x)^2, and no gap ever much exceeds that scale.
This is one of the boldest conjectures in number theory: a specific constant,
1, pinned to a heuristic. It remains completely open — the best proven
upper bound on gaps (from the theory of the zeta zeros) is far weaker, of the order
p_n^{0.525}. Yet the data tracks
(\ln p)^2 beautifully.
Seeing it: record gaps chase (\ln x)^2
A record (or maximal) gap is one bigger than every gap before it. Sieving the primes
up to five million and tracking the running-largest gap gives the staircase below; the smooth curve
is Cramér's predicted scale (\ln x)^2. The record gaps climb in lockstep
with the curve — always a little beneath it, at roughly 0.7–0.9
times its height, exactly as the record data does out to the largest gaps ever computed.
The useful summary statistic is the merit of a gap,
M = g_n / \ln p_n — the gap measured in units of the local average spacing.
Cramér's conjecture says merits can grow all the way up to \ln p_n. The
table shows merit creeping upward exactly as that predicts:
| prime p ending the gap |
gap g |
merit g/\ln p |
| 113 | 14 | 2.96 |
| 1327 | 34 | 4.73 |
| 31397 | 72 | 6.96 |
| 4652353 | 154 | 10.03 |
| \approx 1.43\times10^{18} | 1476 | 35.3 |
Worked example: prime gaps near 10^{18}
Let's put the model to work at a genuinely large scale, x = 10^{18}, and
then check it against real record data. First the local average spacing:
\ln x = \ln 10^{18} = 18\ln 10 = 18 \times 2.302585\ldots \approx 41.4.
Typical gap. The model predicts consecutive primes near
10^{18} are spaced, on average, about 41 apart —
so out of every 41 or so numbers of that size, one is prime.
Maximal gap. Cramér's conjecture predicts the largest gap seen up to
10^{18} should be about
(\ln x)^2 \approx (41.4)^2 \approx 1718.
Reality check. The largest known prime gap near this range is
g = 1476, following the prime
1{,}425{,}172{,}824{,}437{,}699{,}411 \approx 1.43\times10^{18}. Its merit
is 1476 / 41.8 \approx 35.3. Compare the prediction:
1476 is about 0.86 \times 1718 — the same order
of magnitude, sitting just under the predicted ceiling. The model nailed the scale of the
biggest gap across eighteen orders of magnitude, from a coin toss. The typical gap
\approx 41 is likewise spot-on.
The average gap is \ln x; the maximum is (\ln x)^2
— a whole extra factor of \ln x. Where does that come from? In
N independent coin tosses with success probability
q = 1/\ln x, the longest run of failures has expected length about
\ln(N)\,/\,\ln\!\big(1/(1-q)\big) \approx \ln(N)\cdot\ln x. Up to
x there are N \approx x/\ln x primes, so
\ln N \approx \ln x, and the longest failure run — the biggest gap — is
about \ln x \times \ln x = (\ln x)^2. The square is precisely the
signature of an extreme value in a long random sequence: rare events at the tail scale like
the logarithm of how many chances they had to happen.
The blind spot: the model ignores divisibility
The model's fatal simplification is that it treats every integer alike — but real primes obey
divisibility rules the coins never heard of. The cleanest place to see the damage is
twin primes. In the model, "n prime" and
"n+2 prime" are independent, so
\Pr[n,\,n+2 \text{ both prime}] \approx \frac{1}{\ln n}\cdot\frac{1}{\ln n} = \frac{1}{(\ln n)^2},
which predicts \pi_2(x) \sim x/(\ln x)^2 twin pairs up to
x. But the true count (the Hardy–Littlewood conjecture, and what
the data shows) is
\pi_2(x) \sim 2C_2\,\frac{x}{(\ln x)^2}, \qquad C_2 = \prod_{p>2}\frac{p(p-2)}{(p-1)^2} \approx 0.6601618,
with the correction factor 2C_2 \approx 1.3203. The naive model is
off by 32%. The missing factor is the singular series
\mathfrak{S}, which accounts for divisibility by small primes: real primes
are all odd (so n and n+2 being odd is
correlated, not independent), never divisible by 3, and so on. Each small
prime nudges the true probability away from the naive product. You meet
C_2 properly in
Brun's sieve and the twin prime constant.
The refined Cramér–Granville model
Andrew Granville (1995) patched the blind spot. Instead of tossing a coin for
every integer, first sieve out the multiples of small primes
p \le z, and toss coins only for the survivors — but with a
correspondingly larger probability, so the expected count still matches
\operatorname{Li}(x). The survivors carry the divisibility structure the
naive model threw away, and the singular series \mathfrak{S} reappears
automatically. Twin primes then come out with the right constant 2C_2.
The refinement isn't just cosmetic. Granville showed his model predicts
\limsup_{n\to\infty}\frac{g_n}{(\ln p_n)^2} \ge 2e^{-\gamma} \approx 1.1229,
which is bigger than Cramér's constant 1. Divisibility lets primes
cluster and thin out more extremely than pure coins allow, so the true record gaps may exceed
(\ln x)^2 after all. Whether the constant is 1,
2e^{-\gamma}, or something else is one of the sharpest open questions about
prime gaps.
Maier's theorem: the model provably lies in short intervals
The most beautiful refutation of the naive model is Maier's theorem (Helmut Maier,
1985). Count primes in a short interval of length (\ln x)^A — a
window whose width is a fixed power of the logarithm. The Cramér model says such an interval should
contain about (\ln x)^A / \ln x = (\ln x)^{A-1} primes, with the small,
Poisson-sized fluctuations of independent coins. Maier proved this is false.
-
For every fixed A > 1, the ratio of the actual prime count in
[x,\, x + (\ln x)^A] to the model's prediction
(\ln x)^{A-1} does not tend to
1.
-
Its \limsup is strictly greater than 1 and
its \liminf is strictly less than 1: some
short intervals hold systematically more primes than the model allows, others
systematically fewer.
The mechanism, again, is divisibility. Maier used the small primes (via the sieve) to find windows
where an unusual pile-up or drought of primes is forced — a correlation the independent
coins can never reproduce. So the Cramér model is not merely imprecise in short intervals; it is
provably wrong there. It remains an indispensable guide to the scale of prime-gap
phenomena, but its finest predictions must be taken with a fistful of salt.
Everything the model "proves" is really a prediction — a statement about a fictional random
set that we hope the primes imitate. Never quote it as established fact. Three concrete
warnings:
-
The twin-prime constant is wrong. The naive product gives
x/(\ln x)^2, but the truth carries the factor
2C_2 \approx 1.32. You must put in the singular series by hand — the
model does not know about divisibility.
-
Maier disproved the short-interval predictions. Primes in
[x, x+(\ln x)^A] do not follow the Poisson behaviour the naive
model claims. This is a theorem, and it kills the model at fine resolution.
-
Even the headline constant is disputed. Cramér said the limsup is
1; Granville's refined model says at least
2e^{-\gamma} \approx 1.12. The model gives you the shape
(\ln x)^2, not a guaranteed constant.
Because being approximately right for the right reason is worth more than being
exactly right by accident. The Cramér model is where nearly every conjecture about prime patterns is
born: guess the answer by computing the corresponding probability, then — crucially — repair
it with the singular series to respect divisibility. That two-step recipe (random heuristic + local
correction) produced the Hardy–Littlewood k-tuple conjectures, the
predicted density of prime constellations, and the modern conjectures on gaps. The model is a
hypothesis-generating machine. Its failures, like Maier's theorem, are not embarrassments but
signposts: they mark exactly where the arithmetic of the primes refuses to be random.