Are Prime Numbers Endless?

Yes. There's an elegant proof that there are infinite primes. Let's see if I can construct it even having not done number theory since 2005 or so!

I won't prove everything you need, but there is a lemma "For integers m and n: m, n, and m*n+1 are relatively prime." Let's just take that as true so I don't have to type the proof here. It's not a hard proof.

Assume that there is a finite number of primes (say n of them): p1 < p2 < p3 < ... < pn.

Let P be p1*p2*...*pn+1. P > pn. By the axiom above, we know p1, p2, ..., pn, and P are relatively prime. P > pn, so P is not prime. That means there is a prime factorization of P.

OK now for a rough sketch: whatever the prime factorization of P is, none of those factors can be in the set {p1, p2, ..., pn} because of the relative primeness of P and each element of the set. But that is the complete set of all primes.

Contradiction!

Therefore P is prime, our original assumption that there is a finite number of primes has resulted in a contradiction, so we must assume the opposite: there is an infinite number of primes.

/r/askscience Thread