# Why are all non-prime numbers divisible by a prime number?

In Euclid's infinite prime numbers proof, the logic is as follows:

Assume a set $S$ of all prime numbers in existence is finite (there are a finite amount of primes)

Then there must be a greatest prime $p$

$$n = (2 \cdot 3 \cdot 5\cdots p) + 1$$

$n > p$, and under the proof's assumption, $n$ cannot be prime.*

This is where the logic confuses me. Why is it that given that the if a number is not prime, then it is automatically divisible by a prime. I can't think of an example to contradict, but that's not proof that there exists no number that is not prime and non divisible by primes.

-
Well, $1$ is not. But all other positive integers are. – André Nicolas Aug 28 '14 at 4:15
It is not true that Euclid's proof was by contradiction, although many great mathematicians have written that it is. See my answer below. – Michael Hardy Aug 28 '14 at 4:20
@TylerHG, that isn't true though? All numbers divisible are not prime, but that doesn't mean all nonprime numbers are divisible by 2. For example, 21 isn't prime and it isn't divisible by 2. – Jake Byman Aug 28 '14 at 4:51
Euclid's Elements itself makes this fact explicit, see Book VII, proposition 31, "Any composite number is measured by some prime number". – Jeppe Stig Nielsen Aug 28 '14 at 9:58

One can prove this for all integers greater than $1$ by induction: we know that $2$ is a prime. Now for ou inductive step assume that for all $i<n$, $i$ is either prime or divisible by a prime. Case 1: $n$ is prime; we're done. Case 2: $n$ is composite, so $ab = n$ for $a, b < n$. So each of those is divisible by a prime. We're done.

Essentially the same argument shows that all integers greater than $1$ can be written as a product of primes.

-
'Essentially the same argument shows that all integers greater than 1 can be written as a product of primes.' -- except prime numbers I would assume. – krowe Aug 28 '14 at 6:24
@krowe A product of only one number is still considered a product in mathematics. :) (Actually, the product of no numbers is usually defined to be $1$, so one could say that $1$ can be written as a product of primes, too.) – JiK Aug 28 '14 at 7:25
I have heard that said before but I've always assumed that is because, 3*1 ~ 3. I guess this is where my disconnect lies. If I'm understanding you right then you are saying that it's because 3*NULL ~ 3. Also, you are saying that NULLNULL ~ 1. I'm sorry but I reject any math based on what appears to be the concept that NULL ~ 1 when multiplying. The way I see it, 3*NULL ~ NULL and NULLNULL ~ NULL. Fortunately, so does every computer language I've ever used. – krowe Aug 28 '14 at 9:36
@krowe: When forming the product of $n$ numbers, only $n-1$ multiplications are involved. Hence in forming the product of one number, no (zero) multiplications are performed; no notion of NULL is involved at all. Calling it a product is only a manner of speaking, or better, is a notion that is defined in terms of multiplication, but without necessarily invoking any multiplication in each concrete case. Actually, the product of $0$ numbers (which would normally involve $-1$ multiplications, obviously absurd) is purely conventionally defined to be the neutral element $1$ for multiplication. – Marc van Leeuwen Aug 28 '14 at 10:16
@krowe - What do you mean by "NULL"? Perhaps you would find this Wikipedia article: en.wikipedia.org/wiki/Empty_product useful in helping you to understand why mathematicians find it natural to make the convention that the product of no numbers at all is 1. – Hammerite Aug 28 '14 at 10:22

Lemma $\$ The least factor $>1\,$ of $\ n>1\,$ is prime.

Proof $\ $$\,n>1 has at least one factor > 1,\, viz. \,n.\, Let \,p\, be its least factor >1.\, Then \,p\, is prime (else \,p\, has a proper divisor \,1 < d < p\, and \,d\mid p\mid n\,\Rightarrow\,d\mid n,\, contra minimality of \,p). Remark \ More generally it proves prime the least element of any set \,S\, of integers > 1 that is closed under divisors > 1,\, i.e. if \,S\, contains \,n\, then \,S\, contains every divisor > 1 of \,n.\, Above the set \,S\, is the set of factors >1 of \,n. We can interpret the proof constructively as follows. Suppose we have an algorithm \,n\mapsto f(n)\, that yields a proper factor of every nonprime \,n > 1.\, Then iterating the algorithm must eventually terminate at a prime factor of \,n,\, for otherwise it would yield an infinite strictly descending sequence of proper factors (see below), contra \,\Bbb N\, is well-ordered$$ n > f(n) > f(f(n)) > f(f(f(n))) >\, \cdots$$- You are in good company in your error. Some great mathematicians, including Dirichlet, have made the same mistake: falsely reporting that Euclid's proof was by contradiction. Euclid's proof says that if you take any finite set of prime numbers (for example,$2$,$11$, and$19$) and multiply them and then add$1$, the resulting number is not divisible by any of the primes in the finite set you started with (thus$(2\cdot11\cdot19)+1$is not divisible by$2$,$11$, or$19$because its remainder on division by any of those numbers is$1$. Therefore, the finite set you started with can be extended to a larger finite set: the prime factors of (in this example)$(2\cdot11\cdot19)+1$.) The reason the number$(2\cdot11\cdot19)+1$must be divisible by some prime is that if it is not divisible by any prime other than itself, then it is prime and it is of course divisible by itself. PS: Some people commenting below are unhappy with my last paragraph above, so I'll add this: Let's do a proof by contradiction on this one: Consider the smallest number$N$that is not divisible by any prime. It cannot be divisble by anything smaller than itself except$1$, since that not-necessarily-prime factor, being smaller than the smallest counterexample, would be divisible by some prime, and then$N$would be divisible by that prime. So not being divisible by anything except itself and$1$,$N$would be prime, and hence divisible by some prime, namely itself. - This is not an answer to the question (which is not about history). – Bill Dubuque Aug 28 '14 at 4:24 ^True, but still very interesting! – Jake Byman Aug 28 '14 at 4:34 @Jake This is by now very-well-known, having been mentioned here many times, going back to the dawn of the site$4\$ years ago e.g. here. It was widely popularized on sci.math long ago. – Bill Dubuque Aug 28 '14 at 4:53
@BillDubuque : It does answer the question, after the comments about history. But you'll notice that the question itself began with comments about history, and the confusion had to be cleared up. – Michael Hardy Aug 28 '14 at 5:07
@MichaelHardy You end your answer with "if it is not divisible by any prime other than itself, then it is prime and it is of course divisible by itself.", which is the starting point of the question. – JiK Aug 28 '14 at 7:27

Assume your "non-prime number" is not divisible by a prime. Because of the unique factorization theorem, all numbers can be written as a product of primes. This means your "non-prime number" can be written as a product of primes. But it can't be written as a product of primes by definition, so it must be divisible by only itself - making your "non-prime number" a prime number.

-