Why is Euclid's proof on the infinitude of primes considered a proof?

I've expressed Euclid's proof on the infinitude of primes on Mathematica:

f[x_] := Product[Prime[n], {n, 1, x}] + 1
TableForm[Table[{f[x], PrimeQ[f[x]]}, {x, 1, 20}]]

Which results in:

$\begin{array}{ll} 3 & \text{True} \\ 7 & \text{True} \\ 31 & \text{True} \\ 211 & \text{True} \\ 2311 & \text{True} \\ 30031 & \text{False} \\ 510511 & \text{False} \\ 9699691 & \text{False} \\ 223092871 & \text{False} \\ 6469693231 & \text{False} \\ 200560490131 & \text{True} \\ 7420738134811 & \text{False} \\ 304250263527211 & \text{False} \\ 13082761331670031 & \text{False} \\ 614889782588491411 & \text{False} \\ 32589158477190044731 & \text{False} \\ 1922760350154212639071 & \text{False} \\ 117288381359406970983271 & \text{False} \\ 7858321551080267055879091 & \text{False} \\ 557940830126698960967415391 & \text{False} \\ \end{array}$

The proof flaws for all those values, how is it considered a proof then? I guess that there might be infinite prime numbers according to the proof, but what is the guarantee that at some point it won't fail indefinitely?


Euclid’s proof differs from what many mathematicians tell you it is. He said this:

Take any finite set of primes. (Don’t assume it’s the set of all primes; don’t make it a proof by contradiction; don’t assume it’s the first $n$ primes; for example it could be $\{2,7,31\}$.)

Multiply them and add $1$. Then show (and this part was done by contradiction) that the prime factors of the resulting number are not in the finite set you started with.

Thus every finite set of primes can be extended to a larger finite set of primes.

Nothing in that argument gives you any reason to think that if you multiply the first $n$ primes and add $1$, the result is prime. That’s a confusion resulting from inattentiveness to what Euclid actually wrote.

I had a joint paper with Catherine Woodgold about this in the Mathematical Intelligencer in autumn 2009. “Prime Simplicity”

An excerpt from our paper:

Only the premise that a set contains all prime numbers could make anyone conclude that if a number is not divisible by any primes in that set, then it is not divisible by any primes.

Only the statement that $p_1\dots p_n+1$ is not divisible by any primes makes anyone conclude that that number "is therefore itself prime", to quote no less a number theorist than G. H. Hardy [who] actually attributed that conclusion to Euclid! (Euclid's statement "Certainly [that number] is prime, or not" [...] clearly shows that Euclid's reasoning did not follow that path.)

The mistake of thinking that $p_1\dots p_n+1$ has been proved to be prime is made all the more tempting by the very obvious fact that that would entail the result to be proved.

[ . . . ]

In any proof by contradiction, once the contradiction is reached, one can wonder which of the statements asserted to have been proved along the way can really be proved in just the manner given (since the argument supporting them does not rely on the initial assumption later proved false), which ones are correct but must be proved in some other way (since the argument supporting them does rely on the initial assumption) and which ones are false. It is easy to neglect that task. One's consequent ignorance of the answers to those questions can lead to confusion: after all, when one remembers reading a proof of a proposition, might one not think the proposition has been proved and is therefore known to be true? G. H. Hardy probably was aware that because the conclusion that $p_1\dots p_n+1$ "is therefore itself prime" was contingent on a hypothesis later proved false, it could not be taken to be proved. But he did not say that explicitly. It seems hard to justify a similar confidence that all of his readers avoided the error into which he inadvertently invited them.


It is not claimed the $p_1 \cdots p_n + 1$ is prime; indeed, as your table shows, it is often not a prime. I think it is safe to assume that Euclid could also compute that it is not always prime.

The point is that it does have at least one prime factor, since it is $> 1$, and this prime factor cannot be any of $p_1, \ldots,p_n$.


The key idea is not that Euclid's sequence $\ f_1 = 2,\ \ \color{#0a0}{f_{n}} = \,\color{#a5f}{\bf 1}\, +\, f_1\cdot\cdot\cdot\cdot\, f_{n-1}$ is an infinite sequence of primes but, rather, that it's an infinite sequence of coprimes, i.e. $\,{\rm gcd}(f_k,f_n) = 1\,$ since, if $\,k<n,\,$ then any common divisor of $\,\color{#c00}{f_k},\color{#0a0}{f_n}\,$ must also divide $\, \color{#a5f}{\bf 1} = \color{#0a0}{f_n} - f_1\cdot\cdot\, \color{#c00}{f_k}\cdot\cdot\, f_{n-1}.$

Any infinite sequence of pairwise coprime $\,f_n > 1 \,$ yields an infinite sequence of distinct primes $\, p_n $ obtained by choosing $\,p_n$ to be any prime factor of $\,f_n,\,$ e.g. its least factor $> 1$.

Remark $ $ A shorter way to present Euclid's proof is to note that iterating the map $\, n\,\mapsto\, n^2\!+n$ generates integers with an unbounded number of prime factors, because $\,n(n\!+\!1)\,$ includes all prime factors $\,n\,$ and some (new!) prime factor of $\,n\!+\!1 > 1$.


If you read Euclid's proof itself -- it's Proposition 20 in Book IX -- you'll see that he explicitly says that the posited product of primes plus $1$ "is either prime or not" [emphasis added].