Logarithmic Integral
y = ∫₂^(max(x, 1)) 1/log(u) du
Open in the app The dials and keys named below are the app's.
What it draws
The curve is an integral whose upper limit is the plot's own x: y = ∫₂^x du / ln u. That is Li(x), the offset logarithmic integral, and it is Gauss's estimate of how many primes there are up to x. It is zero at x = 2 and climbs, more slowly than x, since the integrand 1/ln u shrinks as u grows. At x = 10 the integral is 5.12, where there are four primes. At x = 20 it is 8.86 against eight. The estimate runs a little high, and keeps doing so.
Left of 2 the integral runs backwards and is negative, −0.92 at x = 1.5. At u = 1 the logarithm is zero and 1/ln u has a pole, so the integral down to 1 is infinite. The formula holds its upper limit at 1 below that, max(x, 1), and the curve is blank for every x ≤ 1.
Why 1/ln u
Primes thin out. Near a large number u, about one number in every ln u is prime: one in 4.6 near 100. Summing that density from 2 to x is this integral, so Li(x) is the count such a density predicts. The prime number theorem says the guess is right in the limit: the true count π(x) and Li(x) have a ratio that tends to 1. The simpler estimate x/ln x has the same limit but is worse: at a million, Li overshoots the 78,498 primes by about 130, and x/ln x falls short by more than 6,000.
History
Carl Friedrich Gauss, at 15 in 1792 or 1793, noticed in his tables of primes that their density near n was about 1/ln n; he described the estimate in a letter to Johann Encke in 1849. Adrien-Marie Legendre published the estimate x/(ln x − 1.08366) in 1808. The theorem behind both was proved in 1896 by Jacques Hadamard and Charles-Jean de la Vallée Poussin with Riemann's zeta function. Li(x) exceeds π(x) at every x ever computed, yet John Littlewood proved in 1914 that the difference changes sign infinitely often. The first crossing is known to lie below 1.4·10³¹⁶.
Try
- Compare the simpler estimate, x/log(x): it runs under the primes where Li runs over, reaching only 6.7 at x = 20.
- Plot the integrand, 1/log(x): the chance that a number near x is prime, one in three near 20.
- Divide by x, integral(1/log(u), u, 2, max(x, 1))/x: the fraction of the numbers up to x expected to be prime, falling slowly, 0.44 at x = 20.
- Raise Span of x to 40: the curve keeps climbing, to 14.8 at the far edge, where the primes number twelve.