Euclid's Theorem

Theorem
There are infinitely many prime numbers.

Proof by Contradiction
Assume that there are only finitely many prime numbers, and that there is a grand total of $$n$$ primes.

Then it is possible to define the set of all primes: $$\mathbb{P} = \left\{{p_1, p_2, \ldots, p_n}\right\}$$.

Consider the number: $$n_p = \left({\prod_{i=1}^{n} p_i}\right) + 1$$.

Take any $$p_j \in \mathbb{P}$$:

$$ $$ $$

So $$p_j \nmid n_p$$.

There are two possibilities:


 * $$n_p$$ is prime, in which case it is greater than any in $$\mathbb{P}$$.

That means $$\mathbb{P}$$ does not contain all the primes after all.


 * $$n_p$$ is composite. But from Every Positive Integer Greater than 1 has a Prime Divisor‎, it must be divisible by some prime.

That means it is divisible by a prime which is not in $$\mathbb{P}$$, and again $$\mathbb{P}$$ is not complete.

So we can never create a finite list of all the primes, because we can guarantee to construct a number which has prime factors that are not in this list.

Thus, there are infinitely many prime numbers.

Variant of Proof
There is a variant of this proof which assumes that all the primes (of a supposedly finite set) are listed in order, and multiplied together, and $$1$$ added. The resulting number is then either a prime or contains a prime factor not on that original list.

Such a number is known as a Euclid number.

Although this is not quite the way Euclid originally stated it, it is such a well-known and accessible proof that it is considered to have entered the mainstream of "general knowledge".

Fallacy
There is a danger in the above variant.

It is often seen to be stated that: the number made by multiplying all the primes together and adding $$1$$ is not divisible by any members of that set, so it is not divisible by any primes and "is therefore itself prime".

Sometimes readers think that if $$P$$ is the product of the first $$n$$ primes then $$P + 1$$ is itself prime.

This is not the case. For example:
 * $$\left({2 \times 3 \times 5 \times 7 \times 11 \times 13}\right) + 1 = 30\ 031 = 59 \times 509$$ (both of which are prime).