Skip to content

The Distribution of Primes

Definition. π(x)\pi(x) counts the primes ≤x\leq x: π(10)=4\pi(10) = 4, π(100)=25\pi(100) = 25, π(1000)=168\pi(1000) = 168.

The primes become sparser on average but never stop. The density near xx behaves like 1/ln⁡x1/\ln x; the heuristic at the heart of everything below: a random integer near xx is prime with “probability” about 1/ln⁡x1/\ln x.

Theorem (Bertrand). For every integer n>1n > 1 there is a prime pp with n<p<2nn < p < 2n.

Proof idea (Erdős’s elementary argument). Consider the prime factorisation of the central binomial coefficient (2nn)\binom{2n}{n}; its size (≥4n/(2n+2)\geq 4^n/(2n+2) by elementary bounds) versus the product of prime powers below 2n2n forces at least one prime pp with n<p<2nn < p < 2n to divide it - such a prime divides the coefficient exactly once, contributing a large factor. ■\blacksquare

Immediate corollaries examinable at this level: there is always a prime between nn and 2n2n, so pk+1<2pkp_{k+1} < 2 p_k for the kk-th prime, and hence pk<2kp_k < 2^k.

Theorem (Dirichlet, 1837). If gcd⁡(a,m)=1\gcd(a, m) = 1, the arithmetic progression a,a+m,a+2m,…a, a+m, a+2m, \ldots contains infinitely many primes.

Examples: infinitely many primes ≡3(mod4)\equiv 3 \pmod 4 (there is also an elementary Euclid-style proof for this special case); infinitely many primes ending in …001 (i.e. 1(mod1000)1 \pmod{1000}). The general theorem needs complex analysis (L-functions); quote it, do not prove it, unless the course covers Dirichlet characters.

Special case worth knowing: the Euclid-style proof of infinitely many primes ≡3(mod4)\equiv 3 \pmod 4: suppose p1,…,pkp_1, \ldots, p_k are all of them, set N=4p1⋯pk−1N = 4 p_1 \cdots p_k - 1; every prime factor of NN is ≡3(mod4)\equiv 3 \pmod 4 (products of numbers ≡1 mod 4\equiv 1 \bmod 4 are 1 mod 41 \bmod 4) and cannot be among the pip_i, contradiction.

Theorem (Hadamard, de la Vallée Poussin, 1896).

π(x)∼xln⁡x,i.e.lim⁡x→∞π(x)x/ln⁡x=1.\pi(x) \sim \frac{x}{\ln x}, \qquad \text{i.e.} \qquad \lim_{x \to \infty} \frac{\pi(x)}{x/\ln x} = 1.

Consequences quotable at this level:

  • The nn-th prime satisfies pn∼nln⁡np_n \sim n \ln n.
  • The average gap between consecutive primes near xx is about ln⁡x\ln x.
  • The probability that a random integer near xx is prime is about 1/ln⁡x1/\ln x.

Refinements: the logarithmic integral Li(x)=∫2xdtln⁡t\mathrm{Li}(x) = \int_2^x \frac{dt}{\ln t} is a better approximation, and the Riemann Hypothesis asserts the error is O(xln⁡x)O(\sqrt{x} \ln x); the most famous open problem in mathematics.

Without the PNT, elementary bounds still yield marks:

  • Euclid-style lower bound on π(x)\pi(x): π(2k)≥k\pi(2^k) \geq k (Bertrand repeatedly).
  • Euler’s theorem: ∑p1p=∞\sum_{p} \frac{1}{p} = \infty; proved below; the sketch above becomes a theorem.
  • Typical structured question: use π(x)\pi(x) data to estimate π(106)≈106/ln⁡106≈72382\pi(10^6) \approx 10^6/\ln 10^6 \approx 72382 against the true value 78498, and comment on the systematic overestimate of the naive estimate versus Li\mathrm{Li}.

The divergence of the sum of reciprocal primes

Section titled “The divergence of the sum of reciprocal primes”

Theorem (Euler, 1737). ∑p prime1p=∞\sum_{p\ \mathrm{prime}} \frac{1}{p} = \infty.

Proof. The proof is a rigourisation of the Euler product, and it is worth doing in full because the product is the ancestor of the Riemann zeta function.

Step 1: the finite product identity. For any xx and any finite set of primes PP,

∑n≤x1n  ≤  ∏p∈P, p≤x(1−1p)−1,\sum_{n \leq x} \frac{1}{n} \;\leq\; \prod_{p \in P,\ p \leq x} \left(1 - \frac{1}{p}\right)^{-1},

where PP is taken to be all primes ≤x\leq x. Why: expanding each factor as the geometric series (1−1p)−1=∑k≥0p−k\left(1 - \frac{1}{p}\right)^{-1} = \sum_{k \geq 0} p^{-k}, the product expands into ∑1p1k1⋯prkr\sum \frac{1}{p_1^{k_1} \cdots p_r^{k_r}} over all multisets of the primes in PP; and every n≤xn \leq x factors into primes ≤x≤\leq x \leq those in PP, so its reciprocal 1n\frac{1}{n} is one of the terms of that expansion. Every term of the harmonic sum appears in the expansion, and the expansion has only non-negative terms, so it dominates.

Step 2: the product is at most the harmonic series. The expansion

∏p≤x(1−1p)−1=∏p≤x∑k≥01pk\prod_{p \leq x} \left(1 - \frac{1}{p}\right)^{-1} = \prod_{p \leq x} \sum_{k \geq 0} \frac{1}{p^k}

produces exactly the reciprocals of the numbers whose prime factors all lie in PP; every one of them a positive integer, each appearing once. So the expanded sum is a sub-sum of the harmonic series, and since all terms are positive,

∏p≤x(1−1p)−1≤∑n=1∞1n.\prod_{p \leq x} \left(1 - \frac{1}{p}\right)^{-1} \leq \sum_{n=1}^{\infty} \frac{1}{n}.

(Cleaner than bounding: the sub-sum statement is all Step 4 needs, and it is exact.)

Step 3: the logarithm computation. Take logarithms of the finite product:

log⁡∏p≤x(1−1p)−1=−∑p≤xlog⁡(1−1p)=∑p≤x∑k≥11k pk,\log\prod_{p \leq x}\left(1 - \frac{1}{p}\right)^{-1} = -\sum_{p \leq x}\log\left(1 - \frac{1}{p}\right) = \sum_{p \leq x}\sum_{k \geq 1}\frac{1}{k\,p^k},

expanding each log⁡(1−u)−1=∑k≥1uk/k\log(1 - u)^{-1} = \sum_{k\geq1} u^k/k. The k=1k = 1 terms are exactly ∑p≤x1p\sum_{p \leq x} \frac{1}{p}; the k≥2k \geq 2 terms are bounded uniformly in xx:

∑p∑k≥21kpk≤∑p∑k≥21pk=∑p1p(p−1)≤∑n=2∞1n(n−1)=1,\sum_{p}\sum_{k \geq 2}\frac{1}{k p^k} \leq \sum_{p}\sum_{k\geq 2}\frac{1}{p^k} = \sum_p \frac{1}{p(p-1)} \leq \sum_{n=2}^{\infty}\frac{1}{n(n-1)} = 1,

using pk≥p2≥p(p−1)p^k \geq p^2 \geq p(p-1) for k≥2k \geq 2 and the telescoping of 1n(n−1)=1n−1−1n\frac{1}{n(n-1)} = \frac 1{n-1} - \frac 1n. So

∑p≤x1p  ≥  log⁡∏p≤x(1−1p)−1−1.\sum_{p \leq x}\frac{1}{p} \;\geq\; \log\prod_{p\leq x}\left(1-\frac 1p\right)^{-1} - 1.

Step 4: assemble. The harmonic series diverges, so log⁡∑n≤x1n→∞\log\sum_{n\leq x}\frac 1n \to \infty; by Step 2 the product tends to infinity with it; by Step 3 the sum of reciprocal primes is at least (log of the product) minus 1, hence diverges. ■\blacksquare

The theorem is stronger than infinitude: not only are there infinitely many primes, they are dense enough that their reciprocals diverge; while the reciprocal squares ∑p1/p2\sum_p 1/p^2 converge (by comparison with ∑n1/n2<∞\sum_n 1/n^2 < \infty). Primes are, in this precise sense, much more common than squares.

The same product is the Riemann zeta function’s Euler product ζ(s)=∏p(1−p−s)−1\zeta(s) = \prod_p (1 - p^{-s})^{-1}, and the PNT is the statement about how ζ\zeta‘s analytic behaviour controls π(x)\pi(x). The divergence proved above is the s→1s \to 1 edge of that analytic theory.

  • π(x)∼x/ln⁡x\pi(x) \sim x/\ln x is an asymptotic statement: relative error tends to 0, but the absolute error π(x)−x/ln⁡x\pi(x) - x/\ln x grows.
  • Bertrand gives a prime below 2n2n, not below n+cn + c for fixed cc.
  • Dirichlet’s theorem requires gcd⁡(a,m)=1\gcd(a, m) = 1: no primes ≡0(modm)\equiv 0 \pmod m beyond mm itself, and primes ≡2(mod4)\equiv 2 \pmod 4 beyond 2; coprimality is necessary for infinitude.

Estimate π(108)\pi(10^8) using x/ln⁡xx/\ln x and Li(x)\mathrm{Li}(x): 108/ln⁡108≈5,428,68110^8/\ln 10^8 \approx 5{,}428{,}681 against the true π(108)=5,761,455\pi(10^8) = 5{,}761{,}455; Li(108)≈5,762,209\mathrm{Li}(10^8) \approx 5{,}762{,}209 is dramatically closer. Comment on why Li\mathrm{Li} stays closer for every measurable xx.

π(x)≈xln⁡x−1\pi(x) \approx \frac{x}{\ln x - 1}

The shifted approximation is better over all practical ranges: at x=109x = 10^9 the naive estimate overshoots by about 6%, the shifted one by under 0.1%. Typical structured questions ask you to compute both estimates and to explain why the logarithmic integral dominates.

A second standard question type: given π(100)=25\pi(100) = 25 and π(200)=46\pi(200) = 46, estimate the number of primes between 100 and 200 as 200ln⁡200−100ln⁡100≈46−25=21\frac{200}{\ln 200} - \frac{100}{\ln 100} \approx 46 - 25 = 21, and note that direct counting gives 21; interval estimates are already accurate at this size. Close by stating Bertrand: there is always a prime in any such interval of the form (n,2n)(n, 2n).

A closing remark for exams: quote π(220)\pi(2^{20})-style data accurately if the question supplies it, and never round intermediate logarithms; the marker scheme penalises premature rounding far more than the final answer. A useful sanity check for estimates: π(x)\pi(x) increases by exactly 1 at each prime, so any approximation must stay constant between primes; quote this when explaining why pointwise error is unavoidable.