number theory – Different ways to prove there are infinitely many primes?

The Question :

104 people think this question is useful

This is just a curiosity. I have come across multiple proofs of the fact that there are infinitely many primes, some of them were quite trivial, but some others were really, really fancy. I’ll show you what proofs I have and I’d like to know more because I think it’s cool to see that something can be proved in so many different ways.

Proof 1 : Euclid’s. If there are finitely many primes then $p_1 p_2 … p_n + 1$ is coprime to all of these guys. This is the basic idea in most proofs : generate a number coprime to all previous primes.

Proof 2 : Consider the sequence $a_n = 2^{2^n} + 1$. We have that
$$2^{2^n}-1 = (2^{2^1} – 1) \prod_{m=1}^{n-1} (2^{2^m}+1),$$
so that for $m < n$, $(2^{2^m} + 1, 2^{2^n} + 1) \, | \, (2^{2^n}-1, 2^{2^n} +1) = 1$. Since we have an infinite sequence of numbers coprime in pairs, at least one prime number must divide each one of them and they are all distinct primes, thus giving an infinity of them.

Proof 3 : (Note : I particularly like this one.) Define a topology on $\mathbb Z$ in the following way : a set $\mathscr N$ of integers is said to be open if for every $n \in \mathscr N$ there is an arithmetic progression $\mathscr A$ such that $n \in \mathscr A \subseteq \mathscr N$. This can easily be proven to define a topology on $\mathbb Z$. Note that under this topology arithmetic progressions are open and closed. Supposing there are finitely many primes, notice that this means that the set
$$\mathscr U \,\,\,\, \overset{def}{=} \,\,\, \bigcup_{p} \,\, p \mathbb Z$$
should be open and closed, but by the fundamental theorem of arithmetic, its complement in $\mathbb Z$ is the set $\{ -1, 1 \}$, which is not open, thus giving a contradiction.

Proof 4 : Let $a,b$ be coprime integers and $c > 0$. There exists $x$ such that $(a+bx, c) = 1$. To see this, choose $x$ such that $a+bx \not\equiv 0 \, \mathrm{mod}$ $p_i$ for all primes $p_i$ dividing $c$. If $a \equiv 0 \, \mathrm{mod}$ $p_i$, since $a$ and $b$ are coprime, $b$ has an inverse mod $p_i$, call it $\overline{b}$. Choosing $x \equiv \overline{b} \, \mathrm{mod}$ $p_i$, you are done. If $a \not\equiv 0 \, \mathrm{mod}$ $p_i$, then choosing $x \equiv 0 \, \mathrm{mod}$ $p_i$ works fine. Find $x$ using the Chinese Remainder Theorem.

Now assuming there are finitely many primes, let $c$ be the product of all of them. Our construction generates an integer coprime to $c$, giving a contradiction to the fundamental theorem of arithmetic.

Proof 5 : Dirichlet’s theorem on arithmetic progressions (just so that you not bring it up as an example…)

Do you have any other nice proofs?

The Question Comments :
• This should be community wiki. Anyway, here’s one: the harmonic series diverges, so by considering the Euler product, there must be infinitely many primes. A bit of a sledgehammer though…
• Chapter 1 of Aigner-Ziegler, Proofs from THE BOOK contains six proofs (most of them were already mentioned, though).
• @Patrick: it is strange that, having asked for proofS, you accepted one answer…
• I just want to note here, that Euclid’s proof was in fact both direct and constructive.
• Euclid’s proof is misrepresented here, as it is by many illustrious authors. Euclid never assumed there are only finitely many; his proof was not by contradiction Catherine Woodgold and I published a paper about this misunderstanding: “Prime Simplicity”, Mathematical Intelligencer, Volume 31, Number 4, 44-52, DOI: 10.1007/s00283-009-9064-8

30 people think this answer is useful

When I taught undergraduate number theory I subjected my students to a barrage of proofs of the infinitude of the prime numbers: see these lecture notes. I gave eight proofs altogether. Of course by now the list which has been currently compiled has a large overlap with mine, but one proof which has not yet been mentioned is Washington’s algebraic number theory proof:

Proposition: Let $R$ be a Dedekind domain with fraction field $K$. If $R$ has only finitely many prime ideals, then for every finite degree field extension $L/K$, the integral closure $S$ of $R$ in $L$ is a PID.

(The proof boils down to two facts: (i) a Dedekind domain with finitely many prime ideals is a PID. (ii) with notation as above, the map $\operatorname{Spec S} \rightarrow \operatorname{Spec R}$ is surjective and at most $[L:K]$-to-one, so $R$ has infinitely many prime ideals iff $S$ has infinitely many prime ideals.)

Corollary: There are infinitely many primes.

Proof: Applying the Proposition with $R = \mathbb{Z}$, if there were only finitely many primes, then for every number field $K$, the ring $\mathbb{Z}_K$ of integers in $K$ would be a PID, hence a UFD. But for instance this fails for $K = \mathbb{Q}(\sqrt{-5})$, as $2 \cdot 3 = (1+\sqrt{-5})(1-\sqrt{-5})$ is a nonunique factorization into ireducible elements (since there are no elements of norm $2$ or $3$) in $\mathbb{Z}_K = \mathbb{Z}[\sqrt{-5}]$.

56 people think this answer is useful

The following proof is morally due to Euler. We have

$$\prod_{p \text{ prime}} \left( \frac{1}{1 – \frac{1}{p^2}} \right) = \zeta(2) = \frac{\pi^2}{6}.$$

The RHS is irrational, so the LHS must have infinitely many factors.

31 people think this answer is useful

The following proof is due to Euler. We have

$$\prod_{p \text{ prime}, p \le m} \left( \frac{1}{1 – \frac{1}{p}} \right) \ge \sum_{n=1}^m \frac{1}{n}.$$

The RHS diverges as $m \to \infty$, so the LHS must have an unbounded number of factors.

20 people think this answer is useful

let $p_1,…,p_n$ be the primes less or equal $N$. any integer less or equal $N$ can be written as $p_1^{e_1}\cdot…\cdot p_n^{e_n}\cdot m^2$ with $e_i\in\{0,1\}$ and $m\leq\sqrt{N}$. so there are at most $2^n\sqrt{N}$ integers less or equal $N$, i.e. $N\leq2^n\sqrt{N}$. simplifying and taking logarithms gives $(1/2)\log N\leq n\log2$. since $N$ is unbounded, so is $n$. (due to erdos taken from the book “gamma” by julian havil, a book on euler’s constant)

15 people think this answer is useful

Proof 3 is due to Fürstenberg (see also the Wikipedia page) and is honestly not that different from Euclid’s proof. See this MO question and the corresponding links for an extended discussion.

I give a counting proof here that I think should be better-known. Briefly, let $\pi(n)$ denote the number of primes less than or equal to $n$. The prime factorization of any positive integer less than or equal to $n$ has the form $\prod p_k^{e_k}$ where

$$\sum_{k=1}^{\pi(n)} e_k \log p_k \le \log n$$

so it follows that $e_k \le \log_2 n$ for all $k$, hence that $n \le \left( \log_2 n + 1 \right)^{\pi(n)}$. This gives the following extremely weak version of the PNT:

$$\pi(n) \ge \frac{\log n}{\log (\log_2 n + 1)}.$$

One can use the same idea to prove that any strictly increasing sequence of positive integers which is polynomially bounded has the property that infinitely many primes divide one of its terms, which is stronger than what can be achieved using Euclid’s proof (which only gets you this result for polynomials).

Edit: According to Pete Clark’s notes, the above proof was in some form given by (but does not seem to be originally due to) Chaitin. In his formulation it can be summarized using the following slogan: if there were finitely many primes, then the prime factorization of a number would be too efficient a way of representing it. This is quite a nice slogan in that it immediately suggests the generalization to polynomially bounded sequences.

10 people think this answer is useful

Source : Proofs from the Book, by Martin Aigner and Günter M. Ziegler.

Here is one more proof. I don’t really know who discovered it.

Let $\pi(x) = \# \bigl\{ \text{No of primes} \ \leq x \bigr\}$. Suppose $p$ is the largest element. We consider the Mersenne number $2^{p}-1$, and show that for any prime factor $q$ of $2^{p}-1$ is bigger than $p$. So let $p$ be a prime dividing $2^{p}-1$. So we have $2^{p} \equiv 1 \ (\text{mod} \ q)$. Since $p$ is prime, his means that, the element $2$ has order $p$ in the multiplicative group $\mathbb{Z}_{q}\setminus \{0\}$ of the field $\mathbb{Z}_{q}$. This group has $q-1$ elements, so by Lagrange’s theorem, we know that the order of every element divides the order of the group. Hence $p \mid (q-1)$, which shows that $p < q$.

$\text{Added.}$

8 people think this answer is useful

Another well-known proof which is somewhat related to two of the proofs by Qiaochu above
is to note that for every prime $p \leq n$, the power of $p$ dividing $n!$ is at most
$p^{\frac{n-1}{p-1}}$. Since certainly $p^{\frac{1}{p-1}} \leq 2$, we obtain that
$2^{n \pi(n)} > n!$, where $\pi(n)$ is the number of primes less than or equal to $n$.
Using Stirling’s formula shows that $\pi(n) \to \infty$ as $n \to \infty$. A more careful version of this argument goes back to Chebyshev.

In an AMM paper ( around 1954) called “A Method for finding primes”, John Thompson
came up with a simple, but very nice, variant of Euclid’s argument: if we list a set of distinct primes, $\{p_1,p_2,\ldots, p_n\}$, not necessarily in increasing order, then
for any $k \leq n$, the integer $p_1 \ldots p_k – p_{k+1}\ldots p_n$ is not divisible
by any of the given $p_i$. This may be $\pm 1$, of course, but in that case you can
interchange various $p_i$’s. The point is that you get lots more primes not in your original list this way, and they are divisors of numbers not necessarily so much larger than the primes you start with.

6 people think this answer is useful

There’s a collection at http://primes.utm.edu/notes/proofs/infinite/

6 people think this answer is useful

The following proof can be extracted from Erdős’ proof of Bertrand’s postulate (although perhaps this argument should be credited to Chebyshev). We need the following two lemmas from that page.

Lemma 1: ${2n \choose n} > \frac{4^n}{2n+1}$.

Lemma 2: The greatest power $R(p, n)$ of a prime $p$ dividing ${2n \choose n}$ satisfies $p^{R(p, n)} \le 2n$.

From these two lemmas it follows that

$$\frac{4^n}{2n+1} < {2n \choose n} \le (2n)^{\pi(2n)}$$

which is a contradiction for large $n$ if $\pi(2n)$ is bounded. This gets us within a constant of the PNT:

$$\pi(2n) \ge \frac{n \log 4 – \log (2n+1)}{\log 2n}.$$

6 people think this answer is useful

One proof approach is to construct an infinite set of numbers, any two of which are relatively prime. The proof using Fermat numbers/Euclid’s proof can be considered to follow that approach (so I am not sure if I should even be adding this answer!).

We construct a set explicitly as follows.

Start with $3$. Now if we already have $\{x_1, x_2, \dots, x_n\}$ so far, whose prime divisors are $\{p_1, p_2, \dots, p_r\}$, take $x_{n+1} = 2^{(p_1 -1)(p_2 – 1) \dots (p_r – 1)} + 1$

By Fermat’s little theorem, $x_{n+1} = 1 \mod p_i$ and thus is relative prime to each $x_i$.

Incidentally the Fermat numbers are relative co-prime can also be proved as follows:

If $x = 2^{2^m}$ and $2^{2^m} + 1 = 0 \mod p$, (i.e. $x = -1 \mod p$) then since $2^{2^{n}}$ is an even power of $x$, we have that $2^{2^n} + 1 = 2 \mod p$.

6 people think this answer is useful

Here’s a proof in the language of ring theory. By the division algorithm, $\mathbb{Z}$ is a principal ideal domain. Thus its maximal ideals are precisely those nonzero of the form $(p)$ where $p$ is prime.

Assume for contradiction that there are finitely many primes $p_1, \dots, p_n$. Then the product $j = p_1 \cdots p_n$ lies in every maximal ideal of $\mathbb{Z}$, hence in its Jacobson radical. It follows that $1 + j$ is a unit in $\mathbb{Z}$. But this is absurd, not least because $1 + j > 1$.

(While poking around to see if the proof had already appeared on this site, I also stumbled on a very nice result by Bill Dubuque that an infinite ring with “fewer units than elements” has infinitely many maximal ideals. Apparently, this strengthens an argument by Kaplansky.)

5 people think this answer is useful

Let $P$ be a polynomial with integer coefficients $a_d$ and degree $n$. Then
$$I(P) = \int_{0}^{1} P(x) dx = \sum_{k = 0}^{n} \frac{a_k}{k + 1}$$
If $I(P) \neq 0$ then multiplying by
$L = \text{lcm}[1,2,\ldots, n+1]$ we get
$$L \cdot |I(P)| \geq 1$$
because $L \cdot I(P)$ is an integer. Now note that
$$L = \exp(\psi(n+1))$$
where $\psi(n) = \sum_{p^{k} \leq n} \log p$. Therefore
$$\exp(\psi(n+1)) \geq \frac{1}{|I(P)|}$$
Choose $P(x) = x^m ( 1 – x)^m$. Then on $0 < x < 1$ we have $|P(x)| \leq 2^{-2m}$. Therefore $|I(P)| \leq 2^{-2m}$. Therefore
$$\psi(2m+1) \geq 2m \log 2$$
This proves the infinitude of the primes. In fact it proves more, it proves the Chebychev bound
$$\pi(x) \gg x / \log x$$
This proof cannot be refined to a proof of the prime number theorem. The optimal choice of the polynomial gives only a constant of $0.86 \ldots$ in place of $\log 2$.

REFERENCES: Chapter 10 of Montgomery’s book “Ten lectures on the interface between harmonic analysis and analytic number theory”.

EDIT: Here are the details of the $\gg$ bound. Note that
$\psi(2m + 1) \geq 2m \log 2$ implies $\psi(x) \gg x$ for all $x$. The prime squares and higher contribute $O(\sqrt{x} \log x)$ to $\psi(x)$ and the primes $p$ contributes at most $\pi(x) \log x$ since each $\log p \leq \log x$. Therefore
$$\pi(x) \log x + \sqrt{x}\log x \gg \psi(x) \gg x$$
Hence
$$\pi(x) \gg x / \log x$$

5 people think this answer is useful

There is a very clever one-line proof which I can’t understand why it’s not here. The Proof:

$$0 < \prod\limits_{p} \sin\left(\frac{\pi}{p}\right) = \prod\limits_{p} \sin\left(\frac{\pi(1+2\prod_{p’}p’)}{p}\right) =0 .$$

This proof has created by Sam Northshield in 2015 and published in American Mathematical Monthly.

4 people think this answer is useful

This is taken from Section 1.4 of Andrew Granville’s notes on Prime numbers:

We finish this section by proving that for any $f(t) \in \mathbb Z[t]$ of degree $\ge1$ there are infinitely
many distinct primes $p$ for which $p$ divides $f(n)$ for some integer $n$. We may assume that
$f(n) \ne 0$ for all $n \in \mathbb Z$ else we are done. Now suppose that $p_1,\ldots,p_k$ are the only primes
which divide values of $f$ and let $m = p_1 \cdots p_k$. Then $f(nmf(0)) \equiv f(0) \pmod{mf(0)}$
for every integer $n$, by exercise 1.2a.a, so that $f(nmf(0))/f(0) \equiv 1 \pmod m$. Therefore
$f(nmf(0))$ has prime divisors other than those dividing $m$ for all $n$ but the finitely many
$n$ which are roots of $(f(tmf(0)) – f(0))(f(tmf(0)) + f(0))$, a contradiction.

Exercise 1.2a.a is: Prove that if $f(t) \in \mathbb Z[t]$ and $r,s\in\mathbb Z$ then $r-s$ divides $f(r)-f(s)$.

Other parts of his course notes might be interesting in connection with this question, too.

4 people think this answer is useful

Prove infinite number of primes using Wilson’s Theorem and Euclid’s argument:

Let $P$ be the maximum prime number. From Wilson’s Theorem, $P$ is prime if and only if $P \mid (P – 1)! + 1$. Thus, $(P – 1)! + 1 = kP$, for some natural number $k$.

Let $n > P$ since there are infinite natural numbers,

$(n – 1)! + 1 = rs$, for some natural numbers $r$ & $s$.

If $r=n$ or $s=n$, then $n$ is prime (Wilson’s Theorem) & $n > P$ (proven).

If both $r$ and $s$ are not equal to $n$, let $r$ represents one of the prime factor of $(n – 1)! + 1$.

$r$ cannot be $2$ to $(n-1)$, otherwise $r \mid (n – 1)!$ and $r \mid [(n – 1)! + 1]$ at the same time then $r \mid 1 \rightarrow \; r = 1$, which is impossible.

So this prime factor $r$ is not from $2$ to $n$; it is another prime $> n > P$.

Leow (2013)

4 people think this answer is useful

Proofs from the book has already been mentioned so it seems silly to spell out yet another proof from that source, but on the other hand I feel that this proof deserves special mentioning since it has two rather striking properties:

1) Like you mention in your post the point of many proofs is the construction of a sequence of numbers in which each member $a_n$ is coprime to each of the (finitely many) previous ones. A special feature of this proof is that it shows this fact (for a special sequence $a_1, a_2, a_3, \ldots$) by showing that $a_n$ is comprime to all the (infinitely) $a_m$ succeeding it. The fact that both properties of $a_n$ are equivalent is of course completely elementary but still I found it initially hard to get my head around. And intuitively it is of course weird that it is easier to prove a number coprime to an infinite set of numbers (its successors) than to a finite set of numbers (it predecessors).

2) The proof relies on a mathematical fact that is very dear to me (and probably many mathematicians) as it was the first truly beautiful formula I discovered myself: $$2+2 = 2*2$$ Of course, being older and wiser, this looks like a ‘strong law of small numbers’-type phenomenon rather than a deep equation, so i was all the more happy to see it used as the fundament of a proof of one of the most celebrated facts of mathematics.

So here goes the proof:

Start with an odd number $a_1$ and construct an infinite sequence of odd numbers by $$a_{n+1} = a_n^2 – 2$$

To see that $a_n$ has no common divisors with its successors let $q$ be a prime divisor of $a_n$. It suffices to show that no $a_m$ is never congruent $0 \mod q$ for $m >n$. Well, $a_{n+1} \equiv -2 \mod q$ and, courtesy of the above mentioned beautiful formula, $a_m \equiv 2 \mod q$ for every $m \geq n+2$. $q$ being odd this proves the claim.

2 people think this answer is useful

Here is another idea to prove this statement. Our instructor attributed it to the french mathematician Hermite. The proof goes as follows:

for a given integer $n$. Let $q_n$ be the greatest prime factor of $n! +1$. We claim that $q_n > n$. If not so, then clearly $q_n | n!$ and by construction $q_n|(n! + 1)$, consequently $q_n|1$ Which is impossible, a contradiction reached. Thereby, always there exists a prime number $q_n$ greater than $n$ for any integer $n$ as required.

1 people think this answer is useful

Maybe you wanna use the sum of reciprocal prime numbers. The argument for the fact that
the series diverges you may find here in one of Apostol’s exercise.

1 people think this answer is useful

Let $p$ be the last prime. Then according to Bertrand’s postulate the interval $(p,2p)$ contains a prime number. We get a contradiction.

1 people think this answer is useful

One can prove directly that the Sieve of Eratosthenes produces an infinite sequence of primes (and produces every prime). This is a worthwhile proof to record since, while it lacks much novel content, it is reassuring that the first method one learns to find primes actually works and that one may prove its correctness without any terribly clever tricks – not even appealing to the fact that every number has a prime divisor. This proof also has the advantage of being constructive.

We define, recursively, an ascending sequence of positive integers $$p_1,p_2,p_3,\ldots$$ by the following rule: to determine $$p_n$$, form the set $$S_n$$ of natural numbers greater than $$1$$ not divided by any previous term of the sequence; formally, this set is: $$S_n=\{k\in\mathbb N: k>1\text{ and for all }n’ < n\text{ we have }p_{n’} \text{ does not divide } k\}$$
Let $$p_n=\min S_n$$.

Claim 1: This sequence is well-defined.

The only obstacle here is to see that every $$S_n$$ actually has a minimum since, aside from this possible issue of non-existence, this is a perfectly good recursive definition. Since $$S_n$$ is a set of natural numbers, is the same as showing that it is non-empty. We can use the main idea of Euclid’s proof here and note that $$1+\prod_{n' is in $$S_n$$ to see this (or exhibit an element of $$S_n$$ in any other of the numerous ways one might).

Claim 2: Every term in this sequence is prime.

To prove this, suppose that $$p_n=xy$$ for some $$n\in \mathbb N$$ and some $$x,y\in \mathbb N$$ both greater than $$1$$. Note that $$x, which implies that $$x\not\in S_n$$ by the minimality of $$p_n$$ in $$S_n$$. Therefore, there must be some $$n' such that $$p_{n’}$$ divides $$x$$. Then $$p_{n’}$$ would also divide $$p_n$$, contradicting that $$p_n\in S_n$$.

Claim 3: This sequence is strictly increasing.

Note that $$S_{n+1}$$ is a subset of $$S_n$$, since the condition for inclusion is more strict. Therefore, $$p_n$$ is a lower bound for $$S_{n+1}$$ and since $$p_n$$ cannot be in $$S_{n+1}$$ by definition, it is a strict lower bound. Thus $$p_n < p_{n+1}$$ since $$p_{n+1}\in S_{n+1}$$.

Combined, these three claims show that $$p_1,p_2,p_3,\ldots$$ is an enumeration of infinitely many distinct prime numbers.

Since we’re so close to it, one might as well show one more thing, even if it’s not strictly needed:

Bonus claim: Every prime is in this sequence.

For this, let $$q$$ be a prime and let $$n$$ be the smallest natural number so that $$p_n \geq q$$. We claim that $$p_n=q$$. Note that $$q$$ must be in $$S_n$$ because it has no divisors $$d$$ with $$1 – in particular, no $$p_{n’}$$ with $$n' can divide it. Minimality of $$p_n$$ therefore gives $$p_n \leq q$$ – but, our choice of $$n$$ then gives $$p_n=q$$ by antisymmetry.

0 people think this answer is useful

The following proof use the Euler’s totient function and relies on the fact that $\phi(m) > 1$ for all $m \geq 3$.

Assume that there are only a finite number of primes say $p_1,p_2,\ldots,p_k$. Look at the product of these finite primes i.e. $$m = p_1 p_2 \cdots p_k$$
Now consider any number $n > 1$. Since there are only finite primes, one of the $p_j$’s must divide $n$. Hence, $\gcd(m,n) > 1$. Hence, $\phi(m) = 1$ contradicting the fact that $\phi(m) > 1$ for all $m \geq 3$.

0 people think this answer is useful

(Another take on Euler’s proof, I believe)

Assume there are finitely many primes $\left \{ p_{0}, p_{1}, … p_{k} \right \}$. Since every natural number admits a unique prime factorization up to reordering:

$$\frac{1}{1}+\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+… = \sum_{n_{0}=0}^{\infty}p_{0}^{-n_{0}}\left ( \sum_{n_{1}=0}^{\infty}p_{1}^{-n_{1}}\left ( \sum_{n_{2}=0}^{\infty}p_{2}^{-n_{2}}\left ( … \left ( \sum_{n_{k}=0}^{\infty}p_{k}^{-n_{k}} \right ) …\right ) \right ) \right )$$

$$=\frac{p_{0}}{p_{0}-1}\frac{p_{1}}{p_{1}-1}\frac{p_{2}}{p_{2}-1}…\frac{p_{k}}{p_{k}-1}$$

(The repeated sum accounts for every product of primes exactly once (and includes the number 1). The product below it follows from the geometric series summation formula.)

The R.H.S. converges as there are only finitely many primes, but the L.H.S. is known to diverge. Contradiction.