Euclid, Elements IX.20
Let be any finite list of primes, and put
, so it has a prime divisor . If were one of the , then would divide both and the product , and so would divide their difference, which is . Impossible. So is a prime outside the list.
No finite list contains every prime. Hence there are infinitely many.
Two things almost everyone gets wrong about this
It is not a proof by contradiction, although it is nearly always taught as one. Euclid never assumes the primes are finite. He takes any finite list and produces a prime not on it — a construction, not a refutation. The contradiction framing is a later accretion, and it makes a perfectly constructive argument look like a negative one.
itself need not be prime. A common misreading. For instance
The proof never claims is prime; it needs only that has some prime factor.
Cost: every integer greater than has a prime divisor. That is the whole bill.