# Is there an intuitionist (i.e., constructive) proof of the infinitude of primes?

This question relates to a discussion on another message board. Euclid's proof of the infinitude of primes is an indirect proof (a.k.a. proof by contradiction, reductio ad absurdum, modus tollens). My understanding is that Intuitionists reject such proofs because they rely on the Law of the Excluded Middle, which they don't accept. Does there exist a direct and constructive proof of the infinitude of primes?

• Euclid's proof is essentially constructive: start with any primes $p_1,\ldots, p_n$, then any prime divisor of $p_1\cdots p_n+1$ will be coprime to all of them. Call the smallest one $p_{n+1}$, continue. – Alex B. Mar 31 '11 at 14:06
• I would describe Euclid's proof as indirect and constructive. The logic behind the construction of a prime depends on the premise that you have already listed the complete finite set of primes. For example, applying Euclid's algorithm to {2,3,5,7,11,13}, you get the 'prime' 30,031 = 59 * 509. – Dan Moore Mar 31 '11 at 14:44
• @Dan Moore: There is no such premise. Read Alex Bartel's comment. – Christian Blatter Mar 31 '11 at 14:49
• @Dan: My "plutonium" search keyword was merely a convenient way to locate those sci.math discussions. In fact it is Mr. Plutonium (a well-known crank) who was the source of much of the confusion on sci.math. So be very cautious reading what he writes. Although numerous folks tried to set him straight over many years, he still has many misconceptions about the proof (e.g. a false application to proving that there are infinitely many twin primes) – Bill Dubuque Mar 31 '11 at 15:19
• @Dan: You're mistaken. Applying Euclid's argument to the set {2,3,5,7,11,13} gets you the two primes 59 and 509. Euclid was perfectly explicit in saying the number you get by multiplying some primes and adding 1 is need not be prime. He said its prime factors are not in the set you started with. – Michael Hardy Jul 16 '11 at 23:28

Due to a widely propagated historical error, it is commonly misbelieved that Euclid's proof was by contradiction. This is false. Euclid's proof was in fact presented in the obvious constructive fashion. See Hardy and Woodgold's Intelligencer article [1] for a detailed analysis of the history (based in part on many sci.math discussions [2]).

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\,$$ if $$\,k since 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$$.

A variant that deserves to be much better known is the following folklore one-line proof that there are infinitely many prime integers

$$n\:\! (n+1)\,\ \text{has a larger set of prime factors than does }\, n\qquad$$

because $$\,n+1>1\,$$ is coprime to $$\,n\,$$ so it has a prime factor which does not divide $$\,n.\,$$ Curiously, Ribenboim believes this proof to be of recent vintage, attributing it to Filip Saidak. But I recall seeing variants published long ago. Does anyone know its history?

For even further variety, here is a version of Euclid's proof reformulated into infinite descent form. If there are only finitely many primes, then given any prime $$\,p\,$$ there exists a smaller prime, namely the least factor $$> 1\,$$ of $$\, 1 +$$ product of all primes $$\ge p\:.$$

It deserves to be much better known that Euclid's constructive proof generalizes very widely - to any fewunit ring, i.e. any ring having fewer units than elements - see my proof here.  The key idea is that Euclid's construction of a new prime generalizes from elements to ideals, i.e. given some maximal ideals $$\rm\, P_1,\ldots,P_k,\,$$ a simple pigeonhole argument employing CRT deduces that $$\rm\, 1+P_1\:\cdots\:P_k\,$$ contains a nonunit, which lies in some maximal ideal which, by construction, is comaximal (so distinct) from the initial max ideals $$\rm\,P_1,\ldots,P_k.$$

[1] Michael Hardy; Catherine Woodgold. Prime Simplicity.
The Mathematical Intelligencer, Volume 31, Number 4, 44-52 (2009).

[2] Note: Although the article [1] makes no mention of such, it appears to have strong roots in frequent sci.math discussions - in which the first author briefly participated. A Google groups search in the usenet newsgroup sci.math for "Euclid plutonium" will turn up many long discussions on various misinterpretations of Euclid's proof.

• The article (which is very interesting!) says "the irrationality of $\sqrt{2}$, a negative result that can only be proved by contradiction". While it shows that Euclid's proof that "There are more prime numbers than any proposed multitude of prime numbers" was not by contradiction, that doesn't mean he proved "the infinitude of primes" (which is what the OP asked about) without contradiction -- I would think that, like the irrationality of $\sqrt{2}$, this is a negative result ("there exists no bijection between $\{1, ..., n\}$ and the set of primes") that can only be proved by contradiction. – joriki Mar 31 '11 at 17:38
• Hmm -- thinking about this some more, I'm wondering whether this is just due to my non-intuitionist definition of "infinity", and whether an intuitionist would define "there is an infinitude of primes" to mean precisely the positive statement that Euclid proved? – joriki Mar 31 '11 at 17:45
• @joriki: The article is simply a rehash of what has been discussed to death on sci.math for many decades. For an example of a recent thread touching on the topics you mention see this thread – Bill Dubuque Mar 31 '11 at 18:47
• In constructive mathematics, the statement "there is not a finite number of primes" is weaker than "there is an injective function with domain $\mathbb{N}$ whose range includes only primes". The second is a much more interesting theorem for them, so that's the way that they would normally work with it, but they could use it to prove the weaker one if they wanted. They are used to the fact that classical statements often have to be reworded to be constructively interesting, because classical mathematicians often state things negatively when constructivists would prefer to work positively. – Carl Mummert Apr 2 '11 at 11:51
• @Yai0Phah For specific rings (e.g. $\Bbb Z)$ it may be constructive (depending on your definition of such). – Bill Dubuque Jun 30 '19 at 0:38

Your question is predicated on a common misconception. In fact Euclid's proof is thoroughly constructive: it gives an algorithm which, upon being given as input any finite set of prime numbers, outputs a prime number which is not in the set.

Added: For a bit more on mathematical issues related to the above algorithm, see Problem 6 here. (This is one of the more interesting problems on the first problem set of an advanced undergraduate number theory course that I teach from time to time.)

• Not exactly, Euclid's proof gives a number which isn't divisible by any of the previously listed primes. It happens once in a while that the number you get isn't prime, the smallest example is $2 \cdot 3 \cdot 5 \cdot 7 \cdot 11 \cdot 13 + 1 = 59 \cdot 509$ (which is mentioned by Richard Guy in his famous "Strong Law of Small Numbers" paper). – David Kohler Mar 31 '11 at 16:57
• Pete didn't say what the algorithm is! For example, the algorithm could be: Given any finite list of primes $p_1$, ..., $p_n$, let $P=p_1 p_2 \cdots p_n+1$ and find a prime factor $q$ of $P$ (by trial division). Then $q$ is not in the list. – David E Speyer Mar 31 '11 at 19:33
• @David: right. Of course the algorithm is not known to be efficient (i.e., polynomial time), but that's a whole different game from being constructive. – Pete L. Clark Apr 1 '11 at 6:19
• @DavidKohler so, extend the algorithm with "and then factor the result" :) – Sparr May 19 '13 at 17:00

Euclid's theorem is intuitionistic. Given any finite set S of primes, their product plus one is not divisible by any of the primes and hence is divisible by some prime not in S. This gives a concrete upper bound on the n-th prime as well -- though of course it's astronomical.

• +1. A fact that may help newcomers understand things: constructivists generally treat equality (and multiplication) on natural numbers as decidable. So although they don't generally accept "P or not P", for natural numbers $m,n$ they do accept "$m = n$ or $m \not = n$" as correct. The justification is that they can in principle decide in a finite number of steps whether two natural numbers are equal by computing both of them out, to determine which case holds. This makes it possible to turn many proofs of basic number theory into constructive proofs, because the proofs are algorithmic. – Carl Mummert Apr 2 '11 at 11:59
• You are saying $m, n \in \mathbb N \Rightarrow m = n \lor m \ne n$. Is this an instance of $p \lor \lnot p$? The law is unconditional. You are not claiming $m = n \lor m \ne n$. And in first order logic you can't express the concept of a standard number. So if you want to be formal, you would be claiming the unconditional $m = n \lor m \ne n$ and all your reasoning will be void (because you can't run algorithms on nonstandard numbers (at least finite)). And you are directly contradicting the intuitionist belief without justification. – Zirui Wang Jan 7 '12 at 17:11
• Can you prove the law of excluded middle? And without the law of excluded middle, is Gödel's incompleteness theorem still true? – Zirui Wang Jan 7 '12 at 17:33
• @Zirui Wang: No, the law of noncontradiction still holds in intuitionistic logic. You can't conclude $p$ from $\neg\neg p$ but you can conclude that $p\wedge\neg p$ (and hence $\neg(m=n)\wedge\neg\neg(m=n)$) is invalid. – Charles Jan 11 '12 at 20:55
• @Zirui Wang Re law of excluded middle and Gödel's incompleteness theorem. Gödel's incompleteness theorem states that any consistent system has statments where neither the statment nor the negation of the statement can be proven. This is trivially true for constuctivistic logics. – Taemyr Jan 9 '14 at 9:01

Here's a simple direct proof that not only shows there is an infinite number of primes, but gives a lower bound on how many primes are less than $N$. The idea comes from Erdős.

Let $\pi(N)$ be the number of primes $\leq N$ for a positive integer N. Any positive integer $\leq N$ can be written in the form $$B^2{p_1}^{e_1} {p_2}^{e_2} ... {p_{\pi(N)}}^{e_{\pi(N)}}$$ where the $e_i$'s are 0 or 1 and $B\leq \sqrt N$.

There are at most $2^{\pi(N)}\sqrt N$ possible numbers of this form, and so we have $$2^{\pi(N)}\sqrt{N}\geq N$$ which gives us $$\pi(N)\geq {\log{N}\over{2 \log 2}}$$ which is clearly unbounded.

This idea is used in Erdos' nice proof that $\sum {1\over p}$ diverges, although that is a proof by contradiction and so would not satisfy the intuitionist school. It goes like this. Assume the sum converges. Then there is some $k$ such that ${\sum_{i \geq k+1}} {1\over p_i} < 1/2$. Call the primes $\leq p_k$ the "small" primes, and the primes $\geq p_{k+1}$ the "big" primes. We can divide the positive integers $\leq N$, for arbitrary N, into two groups: those that are divisible by a "big" prime, and those that are not. An upper limit on the number divisible by a "big" prime is $N/2$ (this comes from the assumption that the sum of the reciprocals of the big primes is $\leq 1/2$), and an upper limit on the number not divisible by a "big" prime is $2^k\sqrt N$. Since those two categories include all the positive integers $\leq N$, we must have $N/2+2^k \sqrt N \geq N$. However, that is not true for sufficiently large $N$, and so we have our contradiction, and the series diverges.

• Please use \leq and geq instead of <= and >= for $\leq$ and $\geq$ – t.b. Jul 11 '11 at 10:42
• But how do you prove that form, which is the heart of this proof? Do you have a reference? – Zirui Wang Jan 7 '12 at 15:53
• @ZiruiWang Let $n \le N$ be the integer we want to factorize this way. Consider its prime factorization, $n = p_1^{f_1}p_2^{f_2}\cdots p_{\pi(N)}^{f_{\pi(N)}}$. Let $e_i = 1$ if $f_i$ is odd, $e_i = 0$ otherwise. Then $f_i - e_i$ is even. Set $B = p_1^{(f_1 - e_1)/2}\cdots p_{\pi(N)}^{(f_{\pi(N)} - e_{\pi(N)})/2}$, and you get $n = B^2 p_1^{e_1}\cdots p_{\pi(N)}^{e_{\pi(N)}}$. – Benya Dec 25 '20 at 5:20

Although this is an old post it is instructive to cite the following study on constructive mathematics which clears some common misconceptions related to constructive mathematics by people trained exclusively in classical mathematics.

For example the difference between proof by negation (valid in constructive mathematics) vs proof by contradiction (not valid in constructive mathematics in general)

FIVE STAGES OF ACCEPTINGCONSTRUCTIVE MATHEMATICS (ANDREJ BAUER)

Abstract. On the odd day, a mathematician might wonder what constructive mathematics is all about. They may have heard arguments in favor of constructivism but are not at all convinced by them, and in any case they may care little about philosophy. A typical introductory text about constructivism spends a great deal of time explaining the principles and contains only trivial mathematics, while advanced constructive texts are impenetrable, like all unfamiliar mathematics. How then can a mathematician find out what constructive mathematics feels like? What new and relevant ideas does constructive mathematics have to offer, if any? I shall attempt to answer these questions.

There in you can find explanations why Euclid's proof is valid in constructive mathematics as it is proof by negation.