Home › Logarithms › Lesson 10

The Prime Number Theorem

Lesson 10 of 13

Key idea of this section

π(x) ~ x / ln x   and, more precisely,   π(x) = li(x) + O(x e−c√(ln x))
Equivalent forms:   θ(x) = ∑p≤x ln p ~ x,   ψ(x) = ∑pᵏ≤x ln p ~ x,   pₙ ~ n ln n

History

Let π(x) denote the number of primes not exceeding x. Around 1792, at the age of fifteen, Gauss examined tables of primes and conjectured that their density near x is 1/ln x, so that π(x) ≈ ∫₂ˣ dt/ln t; he described this in an 1849 letter to Encke. Legendre (1798, 1808) proposed π(x) ≈ x/(ln x − 1.08366). Chebyshev (1848–1852) proved that π(x) is of exact order x/ln x and that if π(x) ln x / x has a limit it must equal 1; he also proved Bertrand's postulate that there is always a prime between n and 2n. Riemann's 1859 memoir connected π(x) with the zeros of ζ(s), and in 1896 Hadamard and de la Vallée Poussin independently proved the theorem by showing that ζ(s) has no zeros on the line Re s = 1. Elementary proofs, avoiding complex analysis, were found by Selberg and Erdős in 1948–1949, and D. J. Newman (1980) found a short analytic proof based on a Tauberian theorem.

Theorem 10.1 (Prime number theorem). limx→∞ π(x) ln x / x = 1.

The data

x        π(x)          x/ln x           li(x)
10³      168           144.8            177.6
10⁴      1 229         1 085.7          1 246.1
10⁶      78 498        72 382.4         78 627.5
10⁹      50 847 534    48 254 942.4     50 849 235.0
10¹⁰     455 052 511   434 294 481.9    455 055 614.6

The ratio π(x)/(x/ln x) is 1.161 at 10³ and 1.048 at 10¹⁰, approaching 1 slowly, while li(x) is accurate to within a relative error of about 7·10⁻⁶ at 10¹⁰. Figure 1 shows both ratios on a logarithmic axis.

Why li(x) is better

By integration by parts, li(x) = x/ln x + x/(ln x)² + O(x/(ln x)³). So the statements π(x) ~ x/ln x and π(x) ~ li(x) are equivalent, but x/ln x has relative error of order 1/ln x, whereas the error π(x) − li(x) is, by de la Vallée Poussin (1899), O(x e−c√(ln x)) for some c > 0, smaller than x/(ln x)ᴬ for every A. The best known error term, due to Korobov and Vinogradov (1958), is O(x exp(−c(ln x)3/5(ln ln x)−1/5)). Von Koch (1901) proved that the Riemann hypothesis is equivalent to π(x) = li(x) + O(√x ln x), and Schoenfeld (1976) made this explicit: under RH, |π(x) − li(x)| < √x ln x / (8π) for x ≥ 2657.

Legendre's constant 1.08366 is an artefact of his tables: since li(x) = x/ln x · (1 + 1/ln x + 2/(ln x)² + …) and x/(ln x − A) = x/ln x · (1 + A/ln x + A²/(ln x)² + …), the best constant in the limit is A = 1.

In every computed case li(x) > π(x). Littlewood proved in 1914 that π(x) − li(x) changes sign infinitely often; Skewes (1933) gave the first explicit upper bound for the first sign change, assuming RH, of about 101010³⁴. Modern work places the first crossing below 1.4 × 10³¹⁶.

Chebyshev functions and partial summation

It is technically simpler to count primes with the weight ln p. Define θ(x) = ∑p≤x ln p and ψ(x) = ∑pᵏ≤x ln p = ∑n≤x Λ(n), where the von Mangoldt function Λ(n) equals ln p if n = pᵏ and 0 otherwise. Then ln lcm(1, 2, …, n) = ψ(n), and ψ(x) − θ(x) = θ(x1/2) + θ(x1/3) + … = O(√x ln x).

Proposition 10.2. For x ≥ 2, π(x) = θ(x)/ln x + ∫₂ˣ θ(t)/(t (ln t)²) dt. Consequently π(x) ~ x/ln x if and only if θ(x) ~ x.

Proof. Write π(x) = ∑p≤x (ln p)·(1/ln p) and apply Abel summation with the weights ln p and the smooth function 1/ln t, whose derivative is −1/(t (ln t)²). If θ(t) ≤ Ct, the integral is at most C∫₂ˣ dt/(ln t)² = O(x/(ln x)²), as one sees by splitting at √x. Hence π(x) ln x / x and θ(x)/x have the same limiting behaviour. ∎

Chebyshev's bounds

Theorem 10.3. For all sufficiently large x, (ln 2/2)·x/ln x < π(x) < 3x/ln x. In particular π(x) is of exact order x/ln x.

Proof. Lower bound. Let N = C(2n, n). By Legendre's formula, the exponent of a prime p in N is ∑k≥1 (⌊2n/pᵏ⌋ − 2⌊n/pᵏ⌋). Each summand is 0 or 1 and vanishes when pᵏ > 2n, so pᵛ ≤ 2n for the exact power pᵛ dividing N, and only primes p ≤ 2n occur. Hence N ≤ (2n)π(2n). On the other hand N is the largest of the 2n + 1 binomial coefficients C(2n, k), whose sum is 4ⁿ, so N ≥ 4ⁿ/(2n + 1). Therefore

π(2n) ≥ (n ln 4 − ln(2n + 1)) / ln(2n),

which is asymptotic to (ln 2)·(2n)/ln(2n). For x between 2n and 2n + 2 the same bound holds up to a factor tending to 1, and since ln 2 > ln 2/2, the lower bound follows for large x.

Upper bound. Every prime p with n < p ≤ 2n divides (2n)! but not (n!)², hence divides N, and so ∏n<p≤2n p ≤ N ≤ 4ⁿ. Taking logarithms, θ(2n) − θ(n) ≤ n ln 4. Summing over n = 2ʲ⁻¹ for j = 1, …, k gives θ(2ᵏ) < 2ᵏ ln 4, and for 2ᵏ⁻¹ ≤ x < 2ᵏ we obtain θ(x) ≤ θ(2ᵏ) < 2x ln 4. Now ln p > ½ ln x for √x < p ≤ x, so (π(x) − π(√x))·½ ln x < θ(x) < 2x ln 4, whence π(x) < √x + 4 ln 4 · x/ln x. This proves π(x) = O(x/ln x); a sharper version of the same argument (Erdős, using C(2m + 1, m) to get θ(x) < x ln 4) yields the constant 3 once x is large. ∎

For instance with n = 50 the lower bound gives π(100) ≥ (50 ln 4 − ln 101)/ln 100 ≈ 14.05, so π(100) ≥ 15; the true value is 25.

The n-th prime

Inverting π(x) ~ x/ln x gives pₙ ~ n ln n. Indeed, if x = pₙ then n = π(x) ~ x/ln x, so ln n = ln x − ln ln x + o(1) ~ ln x, and x ~ n ln x ~ n ln n. A sharper statement is pₙ = n(ln n + ln ln n − 1 + o(1)). For n = 10⁶, n ln n ≈ 13 815 511, while p₁₀₀₀₀₀₀ = 15 485 863; including the correction gives n(ln n + ln ln n − 1) ≈ 15 441 302, within 0.3%.

The probabilistic model

The prime number theorem suggests modelling the primes as a random set in which n is "prime" with probability 1/ln n, independently (Cramér, 1936). The model predicts that the largest gap between consecutive primes below x is about (ln x)², a conjecture consistent with all data, though Granville has argued the true constant is larger than the model predicts. It also predicts the Riemann-hypothesis-sized error √x ln x for π(x) − li(x). The logarithm is therefore not merely a convenient approximating function: 1/ln x is the natural density of the primes.

Exercise

  • (a)
    Show that ψ(n) = ln lcm(1, 2, …, n), and deduce from the prime number theorem that lcm(1, …, n) = en(1 + o(1)).
  • (b)
    Using pₙ ~ n ln n, show that ∑ 1/pₙ diverges, in agreement with Theorem 9.2.
  • (c)
    Compute π(10⁹)/(10⁹/ln 10⁹) to three decimals.
Show solution

Answers: (a) The exponent of a prime p in lcm(1, …, n) is the largest k with pᵏ ≤ n, so ln lcm(1, …, n) = ∑p≤n kp ln p = ∑pᵏ≤n ln p = ψ(n). The prime number theorem in the form ψ(x) ~ x gives ln lcm(1, …, n) = n(1 + o(1)). (b) 1/pₙ ≥ c/(n ln n) for large n and some c > 0, and ∑ 1/(n ln n) diverges by the integral test (Lesson 8). (c) 10⁹/ln 10⁹ = 10⁹/20.7233 ≈ 48 254 942, and 50 847 534/48 254 942 ≈ 1.054.

V.3.1