Finding Primes: Ancient Methods and Timeless Proofs
How do we find prime numbers? And how do we know there isn't a largest one?
The Sieve of Eratosthenes
One of the earliest known algorithms for finding all prime numbers up to a specified integer was devised by the Greek mathematician Eratosthenes of Cyrene (c. 276 BC – c. 194 BC). It's known as the Sieve of Eratosthenes.
The method is as follows:
- Create a list of consecutive integers from 2 up to your desired limit, say .
- Start with the first prime number, . Mark all multiples of (i.e., ) up to as composite.
- Find the next number in the list that has not been marked. This number is the next prime. Let this be the new .
- Repeat step 2 with this new prime .
- Continue this process until . All remaining unmarked numbers in the list are prime.
For example, to find primes up to 30:
- List: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30.
- : Mark 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30. Remaining: 2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29.
- Next unmarked is 3. : Mark 9, 15, 21, 27 (6, 12, etc., already marked). Remaining: 2, 3, 5, 7, 11, 13, 17, 19, 23, 25, 29.
- Next unmarked is 5. : Mark 25 (10, 15, etc., already marked). Remaining: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29.
- Next unmarked is 7. . , which is greater than 30. So we stop. The primes are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29.
Euclid's Proof: The Infinitude of Primes
Are there infinitely many prime numbers, or is there a largest prime? Euclid of Alexandria (c. 300 BC) provided an elegant proof that there are indeed infinitely many primes. It's a classic example of proof by contradiction.
Here's the essence of the proof:
- Assume the opposite: Suppose there is a finite number of primes. Let them be , where is the largest prime.
- Construct a new number: Consider the number formed by multiplying all these primes together and adding 1:
- Analyze :
- If itself is prime, then we have found a new prime number not in our original list , because is clearly larger than any . This contradicts our assumption that was the largest prime.
- If is composite, then it must be divisible by some prime number. Let this prime divisor be .
- Now, cannot be any of the primes in our list . Why? If were one of these , then would divide . Since also divides , it must divide their difference: .
- But this difference is .
- So, must divide 1. The only positive integer that divides 1 is 1 itself. But is a prime number, and by definition, primes are greater than 1. This is a contradiction.
- Conclusion: Our initial assumption that there is a finite number of primes must be false. Therefore, there are infinitely many prime numbers.
This proof is a cornerstone of number theory, showcasing the power of logical deduction.