# 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. Commented Aug 28, 2014 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. Commented Aug 28, 2014 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. Commented Aug 28, 2014 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". Commented Aug 28, 2014 at 9:58
• "Why is it that given that the if a number is not prime, then it is automatically divisible by a prime." This is the result known as the fundamental theorem of arithmetic. Every positive number greater than 1 can be written as a prime , or as a product of primes uniquely (up to order).
– john
Commented Dec 2, 2019 at 8:02

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.

• @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
Commented Aug 28, 2014 at 7:25
• I think your proof should mention (at least one of) $a>1$ and $b>1$. They easily follow from $b<n$ respectively $a<n$, but in such elementary proofs it seems useful to make clear that one is applying the inductive hypothesis to numbers in the range for which it is being proved (here: the integers greater than $1$). Commented Aug 28, 2014 at 10:08
• @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. Commented Aug 28, 2014 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. Commented Aug 28, 2014 at 10:22
• @SteveJessop: With that definition of composite, I would write the proof even differently (you then get just one factor from the definition, but that suffices, at least in your first paragraph proof). But why not define a (positive) number composite if it can be written as product of two positive numbers${}>1$? That's easier, and gives you what you want right away (but you must show the product strictly larger than the factors). Commented Aug 28, 2014 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). Commented Aug 28, 2014 at 4:24
• ^True, but still very interesting! Commented Aug 28, 2014 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. Commented Aug 28, 2014 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. Commented Aug 28, 2014 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
Commented Aug 28, 2014 at 7:27

The answer by @Don Larynx gives me an idea without further looking at the unique factorization theorem.

Why a non-prime is always divisible by a prime? When a number P is divisible by n1 then n1 is a factor of P. For example P = n1 x n2 x n3. So P is divisible by either n1, n2, n3 (the quotient is a positive whole number) and these 3 numbers are factors of P. Lets say we want to factor P, we can start with 2 factors, P = n1 x n2. If both n1 and n2 are primes then we have answered the question. If any of the factor is non-prime, then we can continue to break down that non-prime factor until eventually all the factors is a prime (divisible by itself and 1). For example:

1.) 200 = 10 x 20
2.) 200 = (5 x 2) x (5 x 4)
3.) 200 = (5 x 2) x (5 x (2 x 2))
200 = 5 x 2 x 5 x 2 x 2

1.) 200 = 100 x 2
2.) 200 = (25 x 4) x 2
3.) 200 = (5 x 5) x (2 x 2)) x 2
200 = 5 x 5 x 2 x 2 x 2

So we can say a prime can only be a product of itself and 1. A non-prime can eventually be reduced to a product of 2 or more prime numbers. Therefore a non-prime is always divisible by a prime.