WordGPT
← From Basel to the Riemann hypothesis

The primes enter · Part 2 of 3

Counting primes: Gauss, Legendre and the logarithmic integral

Define π(x), look at the real counts up to a billion, see how Gauss guessed that primes thin out like 1/ln x, and compare the approximations x/ln x and Li(x).

Euler's product ties to the primes. The question that drove nineteenth-century number theory, and gave Riemann his target, is a counting question: how many primes are there up to ? Write for the answer. (This has nothing to do with the circle; it is just the standard name.)

The staircase

(the primes 2, 3, 5, 7). . The function jumps by 1 at every prime and is flat in between.

The staircase π(x) up to 100 with x/ln x below it and Li(x) just above0102030405060708090100051015202530xπ(x)π(x), the primes up to xx / ln xLi(x)
The prime counting function π(x) up to 100 is a staircase. The dashed curve x/ln x lies below it and the solid curve Li(x) follows it closely.

Here are real counts, from a computer sieve:

25 21.7 1.151
168 144.8 1.161
1 229 1 085.7 1.132
9 592 8 685.9 1.104
78 498 72 382.4 1.084
664 579 620 421 1.071
5 761 455 5 428 681 1.061
50 847 534 48 254 942 1.054
455 052 511 434 294 482 1.048

The ratio in the last column is slowly drifting towards 1. This is what Gauss and Legendre saw.

Gauss's guess: the density is

Among the first 100 numbers, 25 are prime: a quarter. Among the first thousand, 168: a sixth. Among the first million, 78 498: about one in 12.7. Gauss, who as a teenager counted the primes in published tables, noticed that these shares are close to :

In his words (in a letter of 1849 recalling about 1792), the density of primes near is about .

The share of primes among the first x numbers falls like 1/ln x10100100010 000100 0001 000 00000.10.20.30.40.5x (logarithmic scale)share of numbers ≤ x that are primeπ(x) / x1 / ln x (Gauss's guess)
The share of the numbers up to x that are prime (solid) against Gauss's 1/ln x (dashed) on a logarithmic scale. The dashed curve runs just under the true share, and the gap closes slowly.

Why ? A heuristic

Euler's product suggests it. Imagine going through the integers and keeping those with no prime factor up to . The share of such numbers is roughly the product , because a number avoids divisibility by with chance (treating the primes as independent). Mertens proved in 1874 that this product is close to , where is Euler's constant. A number is prime if it has no prime factor up to , so take : the share is about . The true answer is , so the heuristic is off by the factor . The lesson: independence is only approximately true for primes, but even the crude heuristic puts in the denominator.

Two approximations

If the density at is , then the number of primes up to is the sum of densities, which for a smooth curve is an integral. Gauss defined the logarithmic integral

(Some books write , which takes the principal value across the singularity at ; the two differ by the constant , which is unimportant for large .) Integrating by parts once gives a simpler expression that explains the cruder formula :

So is only the first term, and adds the next ones. Legendre in 1798 tried to improve the crude formula by hand and proposed . Chebyshev proved in 1849 that if has a limit, the limit is 1, which means that the "1.08366" cannot be a true constant; the correction is not constant but grows slowly like the series above.

How good is each? At the truth is . The two approximations give:

  • , which is 6 116 too low (7.8% off).
  • , which is 130 too high (0.17% off).

At : ; , only 1 701 higher, an error of 0.003%.

Two approximations of π(x) compared with the truth up to a million: Li(x) is far closer than x/ln x10100100010 000100 0001 000 0000.80.911.11.21.3x (logarithmic scale)ratio to π(x)1(x / ln x) ÷ π(x) (always below 1)Li(x) ÷ π(x)
The two approximations divided by the true π(x), up to a million, on a logarithmic horizontal axis. The ratio for x/ln x (below 1) approaches 1 painfully slowly; the ratio for Li(x) is already within a fraction of a percent.

The conjecture

The ratio gets closer to 1, and so does . Gauss and Legendre conjectured:

where means that the ratio tends to 1. This is the prime number theorem, proved in 1896. A more precise version says with an error that is far smaller than . What the error can be is exactly what the Riemann hypothesis decides.

A useful reformulation: the -th prime

If then the -th prime satisfies , so . Check: the 1000th prime is 7919 and ; the 1 000 000th prime is 15 485 863 and . The gap between consecutive primes near is therefore about on average: near a million, a prime appears roughly every 14 numbers.

Where this leads

We now have a target: prove that , and then understand the error. The tools are not going to be elementary counting arguments. The next chapter gets the first rigorous bounds from the factorization of binomial coefficients. After that we turn to Riemann's plan, which is to use the zeta function.

Check yourself

1. Estimate with and say whether the true value is above or below.

. The true value is , which is above, as always for in the range computed.

2. What is the average gap between primes near ?

About .

3. Why does Legendre's constant not have to be a constant?

Li(x) expands as , and . The first two terms agree for , and the rest of the series cannot be matched by any fixed . Chebyshev's result is that the best possible limiting value is , not 1.08366.

Stuck on a step? Take it further.

Ask in WordGPTSolve a problemMarkdownMake a Word file

Part of the free WordGPT Learn section. WordGPT is an AI writing workspace for documents, resumes, websites and study.

    Counting primes: Gauss, Legendre and the logarithmic integral — From Basel to the Riemann hypothesis | WordGPT