25

In Euclid's proof, if $p_1, p_2, \dots, p_n$ are the only primes then $p_1 \times p_2 \times \dots \times p_n + 1$ is not divisible by any of $p_1, p_2, \dots, p_n$ (because of some algebraic facts), which makes another prime and is a contradiction.

The proof makes sense logically, and I tried some numerical examples to "feel" the proof better but...

$2 \times 3 \times 5\times 7\times 11\times 13+1$ is not a prime! $2 \times 3 \times 5\times 7\times 11\times 13 \times 17+1$ is also not prime! Why is the general case proof is not working for these examples?

Jojodmo
  • 107
  • 4
  • 45
    It is a common mistake to think that $p_1p_2...p_n+1$ is prime, it is simply divisible by a prime that is not one of those used in the product. –  Apr 07 '16 at 02:09
  • 3
    @TokenToucan, you should make that an answer. – Mike Pierce Apr 07 '16 at 02:10
  • @TokenToucan $2 \times 3 \times 5\times 7\times 11+1$ is a prime not divisible by any prime –  Apr 07 '16 at 02:12
  • 8
    Here we have the usual historical mistake, dating back at least to Dirichelt, which holds that Euclid's proof was by contradiction. Euclid's actual proof was simpler and better than that. See my answer below. $\qquad$ – Michael Hardy Apr 07 '16 at 02:21
  • 7
    Sure, $2\cdot 3\cdot 5\cdot 7 \cdot 11 \cdot 13 +1$ is prime under the assumption that there are no other primes besides $2,3,5,7,11,13$. After all, under that assumption, $59$ and $509$ aren't primes, right? When proving something by contradiction, the exact path to the contradiction can be left up to taste: all that matters is that a contradiction exists. – Erick Wong Apr 07 '16 at 02:26
  • @ErickWong : $\ldots,$and moreover, rearranging Euclid's actual proof, which was not by contradiction, into a proof by contradiction, adds complications and confusions not in the original proof. See my answer below. $\qquad$ – Michael Hardy Apr 07 '16 at 02:28
  • The proof doesn't actually claim p1p2p3...+1 is prime. It proves that it is not divisible by any of the finite primes. We must conclude one of fpur things i) it is prime and those finite primes aren't all the primes; a contradiction, ii) it is composite and has a prime factor not listed; a contradiction, (THIS HAPPENS SOMETIMES) iii) it is composite with no prime factors; meaningless garbage or iv) it is neither prime nor composite; a logical absurdity. Hence one cannot finitely list all primes. – fleablood Apr 07 '16 at 08:06
  • 3
    See the original Euclid's proof into Euclid, IX,20 : "Take the least number DE measured by A, B, and C. [i.e. $A \times B \times C$.] Add the unit DF [i.e. $1$] to DE. Then EF [i.e. $A \times B \times C + 1$] is either prime or not. First, let it be prime. [...] Next, let EF not be prime. [...] Therefore, prime numbers are more than any assigned multitude of prime numbers." – Mauro ALLEGRANZA Apr 07 '16 at 09:27
  • 4

6 Answers6

69

Suppose there are finitely many primes. Then we can enumerate them as a set $$P = \{p_1, p_2, \ldots, p_n\}.$$ The number $m = p_1 p_2 \ldots p_n + 1$ is either prime or composite. If it is prime, then we have found a prime that is not among the finite set $\{p_1, \ldots, p_n\}$ of primes we assumed to comprise the collection of all primes. If it is composite, then it is divisible by a prime. But it cannot be divisible by any of $p_1, p_2, \ldots, p_n$, for upon dividing $m$ by any of these primes, it leaves a remainder of $1$. Therefore, $m$ is divisible by a prime that again is not in the presumed set of all primes. In either case, a contradiction is obtained in which the assumption that there are finitely many primes is violated.

heropup
  • 135,869
  • 1
    This is a perfect answer. Thanks a lot :)) –  Apr 07 '16 at 02:18
  • 4
    @Edi : This is an erroneous answer if taken to be about the actual history of the proof. It is also not as good a proof as the one Euclid actually wrote. See my posted answer. $\qquad$ – Michael Hardy Apr 07 '16 at 02:22
  • One does not really have to distinguish cases for this argument. Since by assumption we have a complete list of primes, and since $m$ cannot be among them (since it is larger than each $p_i$), it must be some product of those primes (repeated factors allowed), and the product is not empty since $m>1$. Then taking $p$ to be the first factor of the product, we get a contradiction by reducing the equation for$~m$ modulo$~p$. – Marc van Leeuwen Apr 08 '16 at 06:53
  • 3
    @MichaelHardy (http://math.stackexchange.com/questions/631977/why-is-euclids-proof-on-the-infinitude-of-primes-considered-a-proof/632129#632129) I understand this is a pet peeve for you, but maybe it's time to let this one go. This proof is perfectly valid - maybe not as nice as yours, and maybe not what Euclid wrote, but that's by the by. Note that the OP was asking specifically for a proof that the number of primes is infinite, not for a proof that if $S$ is any finite set of primes, then there's a prime not contained in $S$. – John Gowers Apr 08 '16 at 18:00
  • 1
    @Donkey_2009 : How do I "let it go" when people keep posting forms of this question? Stop them, somehow? If this question were closed as a duplicate and directed to that earlier question, that would make sense. This poster thought someone claimed Euclid had proved that $1+p_1\cdots p_n$ is always prime. Should I have (1) left that unanswered, or (2) voted to close as a duplicate, or (3) something else? The confusion arises precisely from the rearrangement of the proof into a proof by contradiction. $\qquad$ – Michael Hardy Apr 08 '16 at 18:56
  • 1
    @MichaelHardy An answer to this question does not require a diatribe into the historical background of Euclid's proof or whether or not it requires contradiction. There are two ways to answer the question: 1) Point out that even if $1+p_1\dots p_n$ is not prime, it must have some prime divisor that is not one of the $p_n$ or 2) Claim that the entire proof is by contradiction, so there's no sense trying to derive anything from it. I agree with you that (1) is far better, but it is sufficient to give the argument without claiming that approach (2) is erroneous. – John Gowers Apr 08 '16 at 19:22
  • 1
    @Donkey_2009 : Pointing out that making it a proof by contradiction merely adds a confusing complication is essential to understanding the matter. $\qquad$ – Michael Hardy Apr 08 '16 at 19:24
62

Euclid's proof was not by contradiction. Many respectable authors say it was, and they're wrong. Dirichlet may have been the originator of the error.

Euclid said that if you take any finite set $S$ of primes (which need not be the first $n$ primes) then the prime factors of $1+\prod S$ are not members of $S$; hence there is at least one more prime than those in any finite set $S$.

Say the finite set you start with is $S=\{5,7\}$. Then $1+\prod S = 36 = 2\times2\times3\times3$, so the additional prime numbers are $2$ and $3$.

There's nothing in that that says $1+\prod S$ (which in the example above is $36$) is prime. That comes up only when the proof is rearranged into a proof by contradiction, and then $1+\prod S$ is shown to be prime, not in the actual sequence of natural numbers, but in the hypothetical set of all natural numbers that contains only finitely many primes. Since that hypothetical set is ultimately shown not to exist, there's no problem.

Moral of the story: Rearranging this into a proof by contradiction makes the matter confusing and more complicated --- hence in those ways inferior to Euclid's original proof.

PS: By popular demand (expressed in comments below), here is a proof that $1+\prod S$ is not divisible by any of the members of $S.$ Suppose $p$ is one of the members of $S.$ If you divide $\prod S$ by $p,$ the quotient is the product of all the other members of $S$ and the remainder is $0$, so if you divide $1+\prod S$ by $p,$ the quotient is the product of those other members and the remainder is $1$. Since the remainder is $1,$ the number $1+\prod S$ is not divisible by $p.$

For example: Suppose $S=\{5,7,13\}.$ Then $N= 1+\prod S$ is $1 + (5\times7\times 13) = 456.$

If you divide $N$ by $5$, the quotient is $7\times 13$ and the remainder is $1.$

If you divide $N$ by $7$, the quotient is $5\times 13$ and the remainder is $1.$

If you divide $N$ by $13$, the quotient is $5\times 7$ and the remainder is $1.$

Dividing $N$ by any of the members of $S$ leaves a remainder of $1$, so $N$ is not divisible by any of those members.

  • 1
    One way of putting it is that Euclid's proof semi-constructively produces an infinite sequence of primes, if you begin with some initial finite set of primes (which as you say need not be the first $n$ of them). I say "semi-constructively" rather than constructively because at some stage you will rather inevitably wind up with a composite, and the procedure does not directly tell you how to factor this composite in order to find a new prime. Of course this is probably not the way Euclid thought about it. – Ian Apr 07 '16 at 02:29
  • 1
    I always used to consider first n primes in the proof! –  Apr 07 '16 at 02:32
  • 1
    @Ian : Can you prove that getting a composite number is inevitable? Might there be some initial finite set $S_1$ for which the set $S_{n+1} = \left[ \text{the set of all prime factors of } 1+\prod S_n \right]$ always contains only one number? If not, how do you prove it? $\qquad$ – Michael Hardy Apr 07 '16 at 02:34
  • 1
    @MichaelHardy While that is actually an interesting number-theoretic question (and I do not have a proof of my claim as stated above), I should add that even if you did stumble upon such an initial set, the procedure itself would not tell you that you had done so. Thus it is still "semi-constructive" in that case because it doesn't directly tell you that the number you just wrote down is actually prime (even if it is). – Ian Apr 07 '16 at 02:37
  • 4
    @Ian : True, but Euclid probably knew a straightforward if laborious algorithm for finding the smallest prime factor of any given number. $\qquad$ – Michael Hardy Apr 07 '16 at 02:38
  • 2
    +1 This is definitely more clever than the usual contradiction formulation... – user541686 Apr 07 '16 at 06:56
  • 2
    I don't know how literally Euclid's proof should be taken. Strictly speaking, he considers only the case that $|S|=3$ (though this is understood to mean any finite set of more than two elements) – Hagen von Eitzen Apr 07 '16 at 11:53
  • @Ian I do not think the proof was really constructive. I believe the statement was more like: "The number of primes is bigger than any finite number". So the proof is like "Take a number $n$ and let $S$ be a set of $n$ primes. [reasoning]. hence there are at least $n+1$ primes". He never actually says that he constructed a new prime, he just says: the cardinality of all the primes must be bigger than $n$. And this is true for every $n$. – Bakuriu Apr 07 '16 at 13:38
  • 2
    To his credit,he did not even say that. He said there was no largest prime because for any finite set of primes, there is a prime not in that set, It is logically quite different than asserting that there is such a thing as the set of all primes, or that there is an infinite set. – DanielWainfleet Apr 07 '16 at 14:01
  • 2
    This answer would be better if it spent more time explaining the details of Euclid's proof (why does $\Pi S_n + 1$ have a prime factor not in $S$?) and less time ranting about proof by contradiction. – Jonathan Cast Apr 07 '16 at 15:21
  • 2
    To those interested in a translation of Euclid's wording, see for example http://aleph0.clarku.edu/~djoyce/java/elements/bookIX/propIX20.html. – Jeppe Stig Nielsen Apr 07 '16 at 15:39
  • curious, to mirror @jcast 's point - the proposition seems to simply state without evidence that prime factors of 1+ΠS cannot be members of S - even the explanation under that translation says, "since they all divide m and do not divide m+1," but no reasoning or reference is given - i assume there must be another proposition which shows this (i think i could work one out, but i mean in the context of elements)? if not, can we really call this proposition a proof without resorting to a contradictive approach? – rsandwick3 Apr 07 '16 at 19:02
  • 1
    @rsandwick3 : I did not include in my posting the proof that $1+\prod S$ is not divisible by any primes in $S$. Euclid did include that argument in his proof. I omitted it only because the question didn't express any uncertainty about that. $\qquad$ – Michael Hardy Apr 07 '16 at 19:30
  • @rsandwick3 : I've added a postscript giving that proof. – Michael Hardy Apr 07 '16 at 19:39
  • @jcast : I've added a postscript giving that proof. Note my comment above explaining why I did not initially include it. $\qquad$ – Michael Hardy Apr 07 '16 at 19:39
  • 2
    Wow. When you explain the proof as you did in your first paragraph, it becomes crystal clear. Thanks, this always bugged me. – Jeel Shah Apr 08 '16 at 16:25
  • 2
    Interestingly, it seems that (the translation of) Euclid's original proof quoted by @JeppeStigNielsen does contain an "unnecessary" proof by contradiction, precisely for the fact that (in modern terms) no prime divisor of $1+\prod S$ can be a member of $S$ (since if it were, it would divide both $\prod S$ and $1+\prod S$, and thus also their difference $1$, "which is absurd"). – Ilmari Karonen Apr 09 '16 at 00:02
  • @IlmariKaronen : Euclid did indeed prove that little lemma by contradiction. $\qquad$ – Michael Hardy Apr 09 '16 at 00:23
  • 1
    @JeelShah : I'm glad you liked it. $\qquad$ – Michael Hardy Apr 09 '16 at 00:24
  • ah, yes, @IlmariKaronen has stated better what i was thinking - i hoped to find earlier in elements a proof that a number which divides two other numbers must also divide their difference, but i'm lazy :-) also, as soon as 2 is added to the set of primes, could a parity argument be made which might eliminate even that contradiction (though obviously then we would no longer be talking about euclid's proof)? in any case, excellent explanation, and thanks for adding the ps! – rsandwick3 Apr 12 '16 at 15:22
  • @DanielWainfleet : Euclid did not say there is no largest prime. Nothing in his proof mentions the idea of a largest prime. – Michael Hardy Sep 05 '17 at 04:35
  • @jcast : In some contexts, the word "ranting" is considered disrespectful. It matters whether it was a proof by contradiction for a number of reasons. A book will say "Since $1+\prod S$ is not divisible by any of the primes, it must be prime itself." and then a student thinks it has been proved that $1$ plus the product of the first $n$ primes is not true. Then the student find counterexamples such as $1+(2\times3\times5\times7\times11\times13) = 59\times509$ and concludes that the proof is wrong. But the proof is not wrong. Only the assumption that the first $n$ primes are$,\ldots\qquad$ – Michael Hardy Sep 05 '17 at 04:43
  • $\ldots,$all primes that exist causes anyone to conclude that if $1+\prod S$ is not divisible by any of those primes, then it has no prime factors besides itself and must therefore be prime. So simply by not making that initial assumtion, one avoids the error. See this paper which Catherine Woodgold and I wrote about this: Michael Hardy and Catherine Woodgold, "Prime simplicity", Mathematical Intelligencer 31(4) (2009), 44–52. $\qquad$ – Michael Hardy Sep 05 '17 at 04:45
15

It is a common mistake to think that $p_1p_2...p_n+1$ is prime, it is simply divisible by a prime that is not one of those used in the product.

And to address your comment - if you do get a prime from $p_1...p_n + 1$, it is divisible by a prime not in the list, which just happens to be itself.

11

The reason that your numerical examples do not work is because the conclusion that "$p_1 p_2 \ldots p_n + 1$ is prime" was based on a false assumption ($p_1, p_2, \ldots, p_n$ are all the primes) made for the purposes of obtaining a contradiction. Once you obtain the contradiction, you've proven the original statement (there are infinitely many primes) but there is no reason to believe any of the intermediate statements will hold, because they are all based on an assumption which you now know to be false.

Ted
  • 33,788
5

It depends on how you start. You can start with "assume that $p_1$ to $p_n$ are primes, and I will demonstrate that there is another prime". You take the product of $p_1$ to $p_n$, add 1, and get a number not divisible by any prime $p$ within $p_1$ to $p_n$, so that number is either a prime itself, or divisible by a prime other than those in the set $p_1$ to $p_n$, and in either case we have another prime.

Or you can try a proof by contradiction. You start with "assume that $p_1$ to $p_n$ are all the primes. Then the product plus 1 is not divisible by any prime (because it is divisible by $p_1$ to $p_n$, which are all the primes) and therefore it is a prime. On the other hand, since $p_1$ to $p_n$ are all the primes it's even more obviously not a prime :-) So we get a contradiction. So the assumption "$p_1$ to $p_n$ are all the primes" is false.

TRiG
  • 203
gnasher729
  • 10,113
4

$2\times3\times5\times7\times11\times13+1$ does not need to be prime, all it says in the proof is that this number is not divisible by any of the primes used to create it, namely 2,3,5,7,11 and 13. The fact that this number needs to be divisible by some prime then yields the result that the list of primes is not complete

Nasenhaar
  • 626
  • 2
    The first counterexample of this form is in fact the one you mention: $$ \Big(2\times3\times5\times7\times11\times13\Big)+1 = 59\times 509. $$ – Michael Hardy Apr 07 '16 at 02:25
  • @MichaelHardy Using Euclid's construction itself starting with 2, you get 3, then 7, then 43, then 1807, and 1807 is divisible by 13. So that's a somewhat smaller "counterexample" (but of course it skips a bunch of primes). – Ian Apr 07 '16 at 02:31
  • 1
    @Ian : I did say "of this form", and that can be construed as meaning it comes from the first $n$ primes. $\qquad$ – Michael Hardy Apr 07 '16 at 02:37
  • 2
    @Ian You construct the interesting sequence 2, 3, 7, 43, 13, .... – Jeppe Stig Nielsen Apr 07 '16 at 10:15
  • 1
    @Ian : A still smaller counterexample even smaller than the one you mention is $(3\times7)+1$, which is divisible by $2$. $\qquad$ – Michael Hardy Apr 07 '16 at 16:06