Section 21.3 The Prime Number Theorem
Subsection 21.3.1 Stating the theorem
Theorem 21.3.1. Prime Number Theorem.
If
In fact, the first bound also has this property (see Exercise 21.5.6):
Historical remark 21.3.2. The Prime Number Theorem.
The Prime Number Theorem was conjectured by Bernhard Riemann in his only paper on number theory. It was proved about 100 years after the initial investigations of Gauss by the French and Belgian mathematicians Jacques Hadamard and Charles-Jean de la Vallรฉe-Poussin. They made good use of the analytic methods we are slowly approaching.
Any proof is this is well beyond the bounds of this text. One of several modern versions is in the analytic number theory text [E.4.6] by Apostol; see also [E.2.9]. Additionally, as a series of exercises (!) in that book, one can also explore a proofโ6โ due to Selberg and Erdลs that is โelementaryโ, in the sense of not using complex-valued integrals. There is a well-known exposition of a very similar proof in [E.2.2], and another in [E.4.4].
xxxxxxxxxx
def _(n=100):
P = plot(prime_pi,3,n, color='black',legend_label=r'$\pi(x)$')
P += plot(Li,3,n, color='green',legend_label='$Li(x)$')
P += plot(lambda x: Li(x) - sqrt(prime_pi(x)),3,n, color='orange', legend_label=r'$Li(x)-\sqrt{\pi(x)}$')
P += plot(lambda x: Li(x) - .5*Li(sqrt(x)),3,n, color='red', legend_label=r'$Li(x)-\frac{1}{2}Li(\sqrt{x})$')
P += plot(lambda x: Li(x) - sqrt(x)/log(x),3,n, color='purple', legend_label=r'$Li(x)-\sqrt{x}/\log(x)$')
show(P, xmin=max(n-1000,0), ymin=prime_pi(max(n-1000,0)))
Subsection 21.3.2 Chebyshev's contributions
Although we cannot explore the theorem itself in depth, we can try to understand some of the intermediate steps. This is a good place to highlight the contributions of the great Russian mathematician Chebyshev.Historical remark 21.3.3. Pafnuty Chebyshev.
Chebyshev (ะงะตะฑัััะฒ) was a prominent Russian mathematician of the mid-19th century, but his most important legacy may be bringing the native Russian tradition into international prominence. (Recall that Euler worked in Russia for much of his life, but alongside other Swiss scientists.) In addition to fundamental advances in this type of number theory, he worked on the theory of orthogonal polynomials which is used so much today in applications, and probability theory underlying modern statistics.
Theorem 21.3.4. Bertrand's Postulate.
For any integer
Proof.
It is actually quite possible to prove this at the level we have reached, but any proof is long enough to take us a little far afield.
xxxxxxxxxx
def _(n=25):
pretty_print(html("$%s$ is a prime between $%s$ and $%s$"%(next_prime(n),n,2*n)))
Fact 21.3.5.
Multiply all the primes
Proof.
We know that \(N\) is a multiple of a prime factorโ7โ of each number \(x\) from \(2\) to \(n+1\text{.}\) For each such \(x\) and prime factor \(p_x\text{,}\) Proposition 1.2.8 guarantees that \(N-x\) is also a multiple of \(p_x\text{.}\)
xxxxxxxxxx
def _(n=5):
N = prod(prime_range(n+2))
pretty_print(html("The numbers between $%s$ and $%s$ are all composite"%(N-(n+1),N-2)))
L = [N-(n+1)..N-2]
print([N-(n+1)..N-2])
pretty_print(html("have factors"))
print([l.divisors()[1] for l in L])
pretty_print(html("and there are $%s$ of them"%(len(L))))
Theorem 21.3.6. Big Oh of Prime Pi.
It is true both that:
is and is
Proposition 21.3.7.
For all positive
Proof.
We follow Stopple's presentation in Section 5.2 of [E.4.5] closely in sketching out most of a proof of this below; see also [E.2.11] for a very similar proof. It is a little longer than some of our other proofs. It uses some very basic combinatorial ideas and calculus facts, however, so it is a great example of several parts of mathematics coming together.
First, it's not hard to verify this for \(x<1000\text{,}\) as the following figure demonstrates.

Now we'll proceed by induction, in an unusual way. We'll assume it is true for \(n\text{,}\) and prove it is true for \(2n\text{.}\) This needs a little massaging for odd numbers, but is a legitimate induction method.
With this in mind, we first assume that \(\pi(n)<2\frac{n}{\log(n)}\text{.}\) Now what?
Below, in Lemma 21.3.9 we look at the product of all the primes (if any) between \(n\) and \(2n\text{,}\) which we write as
In that result some combinatorial thinking leads to the following estimate:
These bounds show that \(P\) is between a certain power of \(n\) and a certain power of \(2\text{.}\)
Now we will manipulate this to get the final result. Begin by taking \(\log\) of both ends to get
Now divide out and isolate to get
In Exercise 21.5.10 you will show that, as long as \(n> 1000\text{,}\) we have the inequality
Now we can put it all together to see that
which is exactly what the proposition would predict.
To rescue this for \(2n+1\text{,}\) we need another calculus comparison. First, from above we have
Since \(2\frac{2n+1}{\log(2n+1)}>\frac{4n}{\log(2n+1)}\text{,}\) it will suffice then to show
Since \(n>1000\) and \(\frac{n}{\log(n)}\) is increasing, \(\frac{1}{n/\log(n)}\lt 0.007\text{,}\) so
To finish it suffices to show that in this range
Showing the last (purely calculus) steps is Exercise 21.5.11.
Lemma 21.3.9.
Let the product of all the primes between
Then we can bound it as
Proof.
Think of all the primes in question. On the one hand, each of these primes \(p\) is greater than \(n\text{,}\) and there are \(\pi(2n)-\pi(n)\) of them. So
On the other hand, each of these primes is greater than \(n\) but they are all in the list of numbers from \(n\) to \(2n\text{,}\) so their product divides
That is to say \(P\) is a factor of a binomial coefficient
and in particular,
We are now ready for the conceptual key of the proof, which uses the combinatorial leitmotif of counting things in two different way. Namely, we reinterpret this factorial fraction as the number of ways to choose \(n\) things from a collection of \(2n\) things! And the number of ways to choose \(n\) things is certainly less than the number of ways to pick any old collection out of \(2n\) things, which is \(2^{2n}\) (because you either pick it or you don't).
Since we showed both bounds, this concludes the proof.