Section 6.2 To Infinity and Beyond
Subsection 6.2.1 Infinite primes
At this point it's a good idea to mention that the search for 100, or 1000, or however many prime numbers is not hopeless! That is the content of Euclid's famous theorem on the infinitude of the primes (Elements Proposition IX.20). Strictly speaking, he proves that no matter whatTheorem 6.2.1. Infinitude of Primes.
There is no upper bound on the size of the collection of prime numbers.
Proof.
Suppose that we have found exactly \(n>0\) prime numbers, \(p_1,p_2,\ldots,p_n\text{.}\) Find the smallest positive integer \(N\) which is a multiple of all of these simultaneously (we know at least one such number exists, since you could multiply them all together).
Then either \(N+1\) is prime, or it is notβ4β. If \(N+1\) is prime, then it is certainly different from the others, so we have increased the size of the set of primes.
If on the other hand \(N+1\) is not prime, then it has some nontrivial factor; in fact, it has a prime divisor \(p\text{.}\) (This distinction does actually require proof, and is Euclid's Book 7, Proposition 31, but we will let it follow immediately from Theorem 6.3.2 instead.) We claim \(p\) is not one of the \(p_i\) already known.
If it were, then if \(p\) is a divisor of both \(N\) and \(N+1\text{,}\) which means it is a divisor of \(1\) (see Exercise 2.5.7). This is absurd (αΌΟΞΏΟΞΏΞ½, literally βout of placeβ). Can you recall why?
So \(p\) is not one of the original list, and is prime, so we have found a larger list than before.

Subsection 6.2.2 The sieve of Eratosthenes
Much later in the text we will talk some about efficient ways to tell if a number is prime, or even to generate new prime numbers (see Chapter 12, for example). For now, we will use something usually known as the Sieve of Eratosthenes.Algorithm 6.2.3. Sieve of Eratosthenes.
To check whether a number
Proof.
If \(n\) is not prime (composite), we can write \(n=de\) for integers \(d\) and \(e\) both strictly between \(1\) and \(n\text{.}\) If both \(d,e\gt \sqrt{n}\text{,}\) then
a contradiction.
Example 6.2.4.
To get all prime numbers up through 100, it suffices to remove any numbers divisible by
Historical remark 6.2.5. Eratosthenes.
Eratosthenes was a contemporary of Archimedes, and no slouch. He is best known for estimating the size of the Earth fairly accurately, amazingly so for the time. (Along the way, that puts the lie to those who would claim everyone thought the earth was flat until Columbus.)