next up previous
Next: Counting Primes Today Up: Lecture 4: The Sequence Previous: Primes of the form

How many primes are there?

There are infinitely many primes.

Can we say something more precise?

Let's consider a similar question:

Question 3.1   How many even integers are there?



Answer: Half of all integers.

Question 3.2   How many integers are there of the form $ 4x-1$?



Answer: One fourth of all integers.

Question 3.3   How many perfect squares are there?



Answer: Zero percent of all numbers, in the sense that the limit of the proportion of perfect squares to all numbers converges to 0. More precisely,

$\displaystyle \lim_{x\rightarrow \infty}
\char93  \{n : n \leq x$    and $n$ is a perfect square $\displaystyle \} / x = 0,$

since the numerator is roughly $ \sqrt{x}$ and $ \sqrt{x}/x \rightarrow 0$.

A better question is:

Question 3.4   How many numbers $ \leq x$ are perfect squares, as a function of $ x$?



Answer: Asymptotically, the answer is $ \sqrt{x}$.

So a good question is:

Question 3.5   How many numbers $ \leq x$ are prime?

Let

$\displaystyle \pi(x) = \char93 \{$ primes $\displaystyle p\leq x\}.
$

For example,

$\displaystyle \pi(6) =\char93 \{2,3,5\} = 3.$

We can compute a few more values of $ \pi(x)$ using PARI:

? pi(x, c=0) = forprime(p=2,x,c++); c; 
? for(n=1,7,print(n*100,"\t",pi(n*100)))
100	25
200	46
300	62
400	78
500	95
600	109
700	125
Now draw a graph on the blackboard. It will look like a straight line...

Gauss spent some of his free time counting primes. By the end of his life, he had computed $ \pi(x)$ for $ x$ up to $ 3$ million.

$\displaystyle \pi(3000000)=216816.$

(I don't know if Gauss got the right answer.) Gauss conjectured the following:

Theorem 3.6 (Hadamard, Vallée Poussin, 1896)   $ \pi(x)$ is asymptotic to $ x/\log(x)$, in the sense that

$\displaystyle \lim_{x\rightarrow \infty} \frac{\pi(x)}{ x/\log(x)} = 1.$

I will not prove this theorem in this class. The theorem implies that $ x/(\log(x)-a)$ can be used to approximate $ \pi(x)$, for any $ a$. In fact, $ a=1$ is the best choice.
? pi(x, c=0) = forprime(p=2,x,c++); c; 
? for(n=1,10,print(n*1000,"\t",pi(n*1000),"\t",n*1000/(log(n*1000)-1)))
1000	168	169.2690290604408165186256278
2000	303	302.9888734545463878029800994
3000	430	428.1819317975237043747385740
4000	550	548.3922097278253264133400985
5000	669	665.1418784486502172369455815
6000	783	779.2698885854778626863677374
7000	900	891.3035657223339974352567759
8000	1007	1001.602962794770080754784281
9000	1117	1110.428422963188172310675011
10000	1229	1217.976301461550279200775705

Remark 3.7  



Subsections
next up previous
Next: Counting Primes Today Up: Lecture 4: The Sequence Previous: Primes of the form
William A Stein 2001-09-19