All Posts
Mathematics

The Prime Number Theorem: How Primes Are Distributed

We explore the Prime Number Theorem — the asymptotic law governing the distribution of prime numbers — its history from Gauss and Legendre to the landmark proofs by Hadamard and de la Vallée-Poussin, and the deep connection between primes and the Riemann zeta function.

The Theorem

The Prime Number Theorem (Hadamard & de la Vallée-Poussin, 1896)

Let π(x)\pi(x) denote the number of primes not exceeding xx. Then:

π(x)xlnxas x\pi(x) \sim \frac{x}{\ln x} \quad \text{as } x \to \infty

Equivalently, limxπ(x)x/lnx=1\displaystyle\lim_{x \to \infty} \frac{\pi(x)}{x / \ln x} = 1.

In words: among the first xx positive integers, roughly x/lnxx / \ln x of them are prime, and this approximation becomes increasingly accurate (in relative terms) as xx grows.


The Prime Counting Function

For any real number x1x \geq 1, the prime counting function is:

π(x)=#{px:p is prime}\pi(x) = \#\{p \leq x : p \text{ is prime}\}

Some values:

xxπ(x)\pi(x)x/lnxx/\ln xRatio
10310^31681451.16
10610^678498723821.08
10910^950847534482549421.05
101210^{12}37607912018361912068251.04

The ratio π(x)/(x/lnx)\pi(x) / (x/\ln x) slowly approaches 11, confirming the theorem.


A Better Approximation: The Logarithmic Integral

While x/lnxx / \ln x captures the leading behavior, a far better approximation is the logarithmic integral:

Li(x)=2xdtlnt\operatorname{Li}(x) = \int_2^x \frac{dt}{\ln t}

Refined Prime Number Theorem

π(x)Li(x)as x\pi(x) \sim \operatorname{Li}(x) \quad \text{as } x \to \infty

Integration by parts gives Li(x)=xlnx+x(lnx)2+2x(lnx)3+\operatorname{Li}(x) = \frac{x}{\ln x} + \frac{x}{(\ln x)^2} + \frac{2x}{(\ln x)^3} + \cdots, so Li(x)\operatorname{Li}(x) includes lower-order correction terms.

For x=1012x = 10^{12}: π(x)=37607912018\pi(x) = 37607912018 while Li(x)37607950281\operatorname{Li}(x) \approx 37607950281, an error of only 0.0001%0.0001\%.


Historical Background

Early Observations

The ancient Greeks knew there are infinitely many primes (Euclid, c. 300 BC), but the density of primes remained mysterious for millennia.

Around 1792, the 15-year-old Carl Friedrich Gauss examined tables of primes and conjectured that the density of primes near xx is approximately 1/lnx1/\ln x. He wrote in a letter much later:

"I noticed as early as 1792 or 1793 that the density of primes around tt is approximately 1/lnt1/\ln t."

Adrien-Marie Legendre independently conjectured in 1798 that π(x)x/(lnxA)\pi(x) \approx x / (\ln x - A) for a constant A1.08366A \approx 1.08366.

Chebyshev's Bounds

Pafnuty Chebyshev (1850) proved that if the limit limxπ(x)/(x/lnx)\lim_{x \to \infty} \pi(x) / (x / \ln x) exists, it must equal 11. He also established the bounds:

0.921xlnx<π(x)<1.106xlnx0.921 \cdot \frac{x}{\ln x} < \pi(x) < 1.106 \cdot \frac{x}{\ln x}

for sufficiently large xx, but could not prove the limit exists.

The 1896 Proofs

The theorem was independently proved in 1896 by Jacques Hadamard and Charles Jean de la Vallée-Poussin, both using complex analysis and properties of the Riemann zeta function.


The Riemann Zeta Function

The key to proving PNT is the Riemann zeta function:

ζ(s)=n=11nsfor Re(s)>1\zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s} \quad \text{for } \operatorname{Re}(s) > 1

Euler's Product Formula

Euler discovered that ζ(s)\zeta(s) has a product over primes:

ζ(s)=p prime11psfor Re(s)>1\zeta(s) = \prod_{p \text{ prime}} \frac{1}{1 - p^{-s}} \quad \text{for } \operatorname{Re}(s) > 1

Proof. Each factor (1ps)1=k=0pks(1 - p^{-s})^{-1} = \sum_{k=0}^{\infty} p^{-ks}. Multiplying over all primes and using the fundamental theorem of arithmetic (unique prime factorization):

pk=0pks=n=1ns=ζ(s)\prod_p \sum_{k=0}^{\infty} p^{-ks} = \sum_{n=1}^{\infty} n^{-s} = \zeta(s) \quad \square

This product formula encodes the distribution of primes in the analytic properties of ζ(s)\zeta(s).

The Critical Connection

Taking logarithmic derivatives of the Euler product relates ζ/ζ\zeta'/\zeta to a sum over prime powers, which connects zeros of ζ(s)\zeta(s) to the distribution of primes. Specifically, the explicit formula of Riemann gives:

ψ(x)=xρxρρln(2π)12ln(1x2)\psi(x) = x - \sum_\rho \frac{x^\rho}{\rho} - \ln(2\pi) - \frac{1}{2}\ln(1 - x^{-2})

where ψ(x)=pkxlnp\psi(x) = \sum_{p^k \leq x} \ln p is the Chebyshev function and the sum runs over the non-trivial zeros ρ\rho of ζ(s)\zeta(s).


Why PNT Follows from Non-Vanishing on Re(s)=1\operatorname{Re}(s) = 1

The proof of PNT reduces to showing:

ζ(1+it)0for all tR,  t0\zeta(1 + it) \neq 0 \quad \text{for all } t \in \mathbb{R}, \; t \neq 0

That is, ζ(s)\zeta(s) has no zeros on the line Re(s)=1\operatorname{Re}(s) = 1. This is what Hadamard and de la Vallée-Poussin proved.

The standard argument uses the inequality:

ζ(σ)3ζ(σ+it)4ζ(σ+2it)1for σ>1\zeta(\sigma)^3 \cdot |\zeta(\sigma + it)|^4 \cdot |\zeta(\sigma + 2it)| \geq 1 \quad \text{for } \sigma > 1

which follows from the identity 3+4cosθ+cos2θ=2(1+cosθ)203 + 4\cos\theta + \cos 2\theta = 2(1 + \cos\theta)^2 \geq 0.

If ζ(1+it0)=0\zeta(1 + it_0) = 0, then the factor ζ(σ+it0)4|\zeta(\sigma + it_0)|^4 would vanish as σ1+\sigma \to 1^+ fast enough to force the product below 11 — a contradiction.


The Equivalent Formulation

The PNT is equivalent to the statement about the Chebyshev function:

ψ(x)xas x\psi(x) \sim x \quad \text{as } x \to \infty

where ψ(x)=nxΛ(n)\psi(x) = \sum_{n \leq x} \Lambda(n) and Λ(n)\Lambda(n) is the von Mangoldt function:

Λ(n)={lnpif n=pk for some prime p0otherwise\Lambda(n) = \begin{cases} \ln p & \text{if } n = p^k \text{ for some prime } p \\ 0 & \text{otherwise} \end{cases}

This formulation is often more natural for analytic proofs.


The Erdős–Selberg Elementary Proof

In 1949, Atle Selberg and Paul Erdős found an "elementary" proof of PNT that avoids complex analysis entirely. The key is Selberg's identity:

ψ(x)lnx+px(lnp)ψ(x/p)=2xlnx+O(x)\psi(x)\ln x + \sum_{p \leq x} (\ln p)\,\psi(x/p) = 2x\ln x + O(x)

From this, PNT follows by careful estimation. The proof was elementary in the technical sense (no complex analysis) but not simple — it was a tour de force of real-variable methods.


Error Terms and the Riemann Hypothesis

The PNT with its best known error term is:

π(x)=Li(x)+O ⁣(xexp ⁣(clnx))\pi(x) = \operatorname{Li}(x) + O\!\left(x \exp\!\left(-c\sqrt{\ln x}\right)\right)

for some constant c>0c > 0.

If the Riemann Hypothesis (all non-trivial zeros of ζ(s)\zeta(s) have real part 1/21/2) is true, then the error term improves dramatically:

π(x)=Li(x)+O(xlnx)\pi(x) = \operatorname{Li}(x) + O(\sqrt{x}\, \ln x)

This is the best possible up to the logarithmic factor — the zeros of ζ(s)\zeta(s) on the critical line create oscillations of order x\sqrt{x} in π(x)\pi(x).


Primes in Arithmetic Progressions

Dirichlet (1837) proved that every arithmetic progression a,a+d,a+2d,a, a+d, a+2d, \ldots with gcd(a,d)=1\gcd(a,d) = 1 contains infinitely many primes. The PNT generalizes to give the asymptotic count:

π(x;d,a)1φ(d)xlnx\pi(x; d, a) \sim \frac{1}{\varphi(d)} \cdot \frac{x}{\ln x}

where φ(d)\varphi(d) is Euler's totient function. Primes are equidistributed among the φ(d)\varphi(d) residue classes coprime to dd.


Summary

π(x)xlnxLi(x)Density of primes near x1lnxProved via: ζ(1+it)0 for all t0Best error: π(x)Li(x)=O(xlnx)(assuming RH)\begin{aligned} &\pi(x) \sim \frac{x}{\ln x} \sim \operatorname{Li}(x) \\[8pt] &\text{Density of primes near } x \approx \frac{1}{\ln x} \\[8pt] &\text{Proved via: } \zeta(1+it) \neq 0 \text{ for all } t \neq 0 \\[8pt] &\text{Best error: } \pi(x) - \operatorname{Li}(x) = O(\sqrt{x}\ln x) \quad \text{(assuming RH)} \end{aligned}

References