Proof that there are infinitely many primes

Written by Patrick Stevens, Joe Zeng last updated

The proof that there are infinitely many prime numbers is a proof by contradiction.

First, we note that there is indeed a prime: namely . We will also state a lemma: that every number greater than has a prime which divides it. (This is the easier half of the Fundamental Theorem of Arithmetic, and the slightly stronger statement that "every number may be written as a product of primes" is proved there.)

Now we can proceed to the meat of the proof. Suppose that there were finitely many prime numbers . Since we know is prime, we know appears in that list.

Then consider the number — that is, the product of all primes plus 1. Since appeared in the list, we know , and in particular .

The number can't be divided by any of the primes in our list, because it's 1 more than a multiple of them. But there is a prime which divides , because ; we stated this as a lemma. This is immediately a contradiction: cannot be divided by any prime, even though all integers greater than can be divided by a prime.

Example

There is a common misconception that must be prime if are all primes. This isn't actually the case: if we let be the first six primes , then you can check by hand that ; but . (These are all somewhat ad-hoc; there is no particular reason I knew that taking the first six primes would give me a composite number at the end.) However, we have discovered a new prime this way (in fact, two new primes!): namely and .

In general, this is a terrible way to discover new primes. The proof tells us that there must be some new prime dividing , without telling us anything about what those primes are, or even if there is more than one of them (that is, it doesn't tell us whether is prime or composite). Without knowing in advance that is equal to , it is in general very difficult to discover those two prime factors. In fact, it's an open problem whether or not prime factorisation is "easy" in the specific technical sense of there being a polynomial-time algorithm to do it, though most people believe that prime factorisation is "hard" in this sense.

Parents: