The Infinitude of Primes
How many prime numbers are there? This simple question was first answered decisively over two thousand years ago. It sits at the foundation of all of number theory. The answer — infinitely many — is easy to state. But its proof introduced a style of argument that has echoed through mathematics ever since. This style combines proof by contradiction with an explicit construction. Understanding why the primes never run out forces us to confront the multiplicative structure of the integers directly. It requires nothing more than the Fundamental Theorem of Arithmetic and the definition of Primes and Composite Numbers. The result matters not because it is hard — Euclid's original argument is a handful of lines. It matters because of what it reveals and what it inspires. It shows that no finite list of primes can ever generate all the integers multiplicatively. This is the seed of the idea that the primes are an inexhaustible set of "atoms." It also opens the door to a whole family of related questions. Not just whether there are infinitely many primes, but how densely they are distributed. It raises the question of which primes exist in which arithmetic progressions. It also asks how various proof techniques — combinatorial, analytic, topological — can all be brought to bear on the same fact. The big picture is that this theorem is the prototype for an entire method. First, assume a finite set exhausts an infinite phenomenon. Then construct an object that must contain new information not accounted for by that finite set. Finally, derive a contradiction. Variants of Euclid's argument use Fermat numbers, factorials, or Euler's product formula. All of these follow this same skeleton. Yet each illuminates different aspects of the primes' structure. This article gives Euclid's proof in full rigorous detail. It also gives a second independent proof due to Euler, using the divergence of a certain infinite sum. It presents a compact combinatorial variant using Fermat numbers. It discusses exactly which hypotheses are essential. It closes by connecting this classical result to its modern descendants. These descendants appear in the study of the distribution of primes.
- There are infinitely many prime numbers; no finite list of primes can contain them all.
- Euclid's proof: given any finite set of primes, multiply them and add 1 to produce a number with a prime factor outside the set.
- The proof is a proof by contradiction built on the Fundamental Theorem of Arithmetic, which guarantees every integer greater than 1 has a prime factor.
- Euler gave an independent, stronger proof via the divergence of , foreshadowing analytic number theory.
- A slick variant uses the pairwise coprimality of Fermat numbers to generate infinitely many distinct prime factors.
- Key idea: any hypothetical finite complete list of primes can be used to construct a number whose prime factors are provably new, a contradiction.
Where this lives today
The infinitude of primes is the entry point to the entire subject of the distribution of primes, foreshadowed by Euler's divergence proof above and developed fully in the study of Elementary Distribution of Primes, including the Prime Number Theorem and the Riemann Hypothesis. In cryptography, the unbounded supply of primes is what guarantees that RSA and other public-key systems always have fresh large primes available to construct keys of arbitrary security level — without infinitude, key sizes would eventually be forced to reuse primes, undermining security assumptions. In algebra, the Euclid-style "construct an object avoiding a finite obstruction set" technique reappears in proofs that there are infinitely many irreducible polynomials over a finite field, and in topological proofs of infinitude of primes (Furstenberg's 1955 proof using a topology on the integers whose open sets are unions of arithmetic progressions). In combinatorics and analytic number theory, Euler's divergence of is the ancestor of sieve methods and of Dirichlet's theorem on primes in arithmetic progressions, which uses an analogous divergence argument for L-functions. Even in theoretical computer science, prime generation algorithms and probabilistic primality testing rely on the guaranteed unbounded density of primes to ensure termination and correctness of randomized algorithms.
Ask the tutor: Can you show me how Euclid's style of argument adapts to prove there are infinitely many primes congruent to ?
An integer is prime if its only positive divisors are and . An integer that is not prime is composite, meaning for some integers with . The claim under discussion, the infinitude of primes, is the statement: > For every positive integer , there exists a prime . Equivalently, the set of primes
is an infinite subset of . Equivalently again: no finite list of primes exhausts all primes — for any such list there is a prime not among them.
Intuition
The heart of the matter is a tension between addition and multiplication. Multiplicatively, the primes are the building blocks: by the Fundamental Theorem of Arithmetic, every integer greater than factors uniquely into primes. If there were only finitely many primes , then every positive integer would be built from this fixed finite palette. Euclid's insight is to use addition to break out of this closed multiplicative world: take the product and shift it by . The number is not divisible by any , because dividing it by any leaves remainder . Yet , so it must have some prime factor. That prime factor cannot be on our list — a genuinely new atom has appeared. Picture the primes as marks on a number line that "generate" all other integers by multiplication. A finite set of generators can only reach numbers built from them; the number deliberately steps just outside every one of their multiplicative shadows, forcing the existence of an unaccounted-for prime.
Central results
There are infinitely many prime numbers. Equivalently, for every finite set of primes (), there exists a prime not in this set.
We use proof by contradiction, combined with the Fundamental Theorem of Arithmetic (existence part: every integer greater than has at least one prime divisor). Step 1 (Existence of a prime factor). First we record the elementary fact, itself a consequence of well-ordering, that every integer has a prime divisor. Indeed, let be the set of divisors of that are greater than ; is nonempty since . By the well-ordering principle, has a least element . We claim is prime. If not, with ; but then is a divisor of (since ) with , contradicting minimality of in . Hence is prime and . Step 2 (Suppose finitely many primes). Suppose, for contradiction, that there are only finitely many primes in total, say exactly
for some (the case , no primes at all, is immediately impossible since is prime by definition, so we may assume ). Step 3 (Construct ). Define
Since each , we have (more precisely ), so by Step 1, has at least one prime divisor . Step 4 ( is not any ). We claim for every . Suppose toward contradiction that for some . Since , we have . Also clearly divides the product (it is one of the factors). Therefore divides the difference
But no prime divides , since the only divisors of are itself, and a prime is by definition greater than . This is a contradiction. Step 5 (Conclusion). Hence is a prime not equal to any of . This contradicts our assumption in Step 2 that is the complete list of all primes. Therefore the assumption of Step 2 is false: there cannot be only finitely many primes. Since the set of primes is not finite, and it is a subset of the positive integers, it must be (countably) infinite. (Remark on the second formulation.) The argument in fact proves the stronger, constructive statement: given any finite set of primes — not necessarily "all primes so far" — the number has a prime factor outside the set. This is exactly Steps 3–4 above, without needing Step 2's contradiction framing; the contradiction form is only needed to convert "arbitrary finite set has a prime outside it" into "the set of all primes is infinite." Both formulations are equivalent and both are established by the proof above.
∎Let denote the (a priori possibly finite) list of primes. Suppose there were only finitely many primes . Then the finite sum is of course finite. We show instead, independently of Euclid's argument, that
which is only possible if there are infinitely many primes.
This is Euler's proof, using analytic estimates and the Fundamental Theorem of Arithmetic; it is logically independent of Euclid's combinatorial argument and gives a quantitatively stronger conclusion. Step 1 (Euler product, finite truncation). Fix and let be all the primes (there are only finitely many integers , hence finitely many primes , regardless of whether itself is finite or infinite). For each prime and any integer ,
a convergent geometric series since . Consider the finite product
Expanding this product of absolutely convergent series, every term is of the form for nonnegative integers . By the Fundamental Theorem of Arithmetic (uniqueness of factorization), as ranges over all nonnegative integer tuples, the numbers range over exactly the set of positive integers whose prime factors all lie among — each such arising from exactly one tuple. In particular, every integer with has all its prime factors (since any prime factor of is at most ), hence all its prime factors among . Therefore
Step 2 (Harmonic series diverges). The harmonic series diverges as ; concretely, grouping terms in blocks of doubling length,
which is unbounded as (each block has terms each , summing to ). Hence the right side of Step 1's inequality tends to as , so
Step 3 (From the product to the sum of reciprocals). Using for (valid since , and the tail when ), we get for each prime :
Summing over primes and taking logarithms of Step 2's divergent product,
while converges (comparison to a convergent -series-type bound), contributing a bounded amount. Therefore
Step 4 (Conclusion). If there were only finitely many primes in total, the sum would be bounded above (by the finite total sum ) for all , contradicting Step 3's divergence. Hence there are infinitely many primes.
∎The numbers for are pairwise coprime, and consequently there are infinitely many primes.
This is a combinatorial variant, due essentially to Goldbach, using a telescoping identity rather than a direct contradiction. Step 1 (Telescoping identity). We claim that for all ,
We prove this by induction on . Base case : , and . Equal, so the base case holds. Inductive step: suppose for some . Then
Now compute . Writing , so , we have . This matches the expression above, completing the induction. Step 2 (Pairwise coprimality). Let . By Step 1, , and since , appears as one of the factors on the right side, so . Suppose is a common divisor of and ; then and implies . So . But every is odd (as is even for , since , and evenodd), so . Hence : . Step 3 (Infinitude of primes). Each , so by the existence-of-prime-factor fact (Step 1 of Euclid's proof above), each has at least one prime factor . Since the are pairwise coprime by Step 2, no prime can divide two different 's: if and with , then , impossible for a prime . Hence the primes are pairwise distinct, giving an infinite sequence of distinct primes, one for each . Therefore there are infinitely many primes.
∎Worked examples
Example 1: Applying Euclid's construction starting from a non-initial, asymmetric finite list. Take the finite set of primes — deliberately not "the first few primes," to test the argument on an arbitrary finite list, as the theorem requires it to work for any finite set. Form
We must find a prime factor of not in . Factor: . Both and are primes, and neither is nor . Indeed and (check: and ), confirming directly that neither nor divides , exactly as the proof guarantees (Step 4: any prime factor of satisfies since those would force ). This example also shows that itself need not be prime — here is composite — but the theorem never claims is prime, only that some prime factor of escapes the given list. This is a common misreading worth flagging explicitly. We can iterate: add and to our list, getting , and repeat:
Checking divisibility: , , (not integer, consistent since was already excluded), , , , and , so it suffices to check primes up to : . None divide (direct check: is odd, digit sum not divisible by 3, doesn't end in 0/5, and the quotients above are non-integers), so in fact itself is prime — a genuinely new prime, consistent with, but stronger than, what the theorem guarantees.
Example 2: The Fermat number variant computed explicitly, with a subtlety. Compute the first few Fermat numbers:
All five are prime (this can be checked directly for these small cases; is prime because it has no prime factor , verifiable by trial division against primes up to ). Check the telescoping identity for :
Matches, confirming Step 1 of the corollary's proof concretely. Now the subtlety, useful for showing the proof does not need each individually prime: consider
This is famously not prime: (a factorization discovered by Euler). The corollary's proof does not require to be prime — it only requires to have some prime factor, e.g. , and that this prime factor is automatically different from every prime factor of because for all . Indeed does not divide (direct check, e.g. , not an integer), consistent with coprimality. This illustrates that the corollary produces an infinite sequence of distinct primes even though not every is itself prime.
The corollary's proof crucially uses that and are coprime for every pair , not just consecutive ones. To see why weakening this to "consecutive Fermat numbers are coprime" would not suffice to prove infinitely many distinct primes, consider a hypothetical (false, but illustrative) scenario where we only knew for each , with no control over or further-apart pairs. Suppose, purely hypothetically, some sequence of numbers satisfied only but had, say, and sharing a common prime factor . Picking prime factors arbitrarily, nothing prevents choosing : the argument "" would then fail, because consecutive-only coprimality gives no obstruction to sharing a factor. The chain of distinctness , does not imply in general (distinctness is not transitive across gaps unless every pair is controlled). For the genuine Fermat numbers this failure does not occur, precisely because the proof establishes full pairwise coprimality (any , not just ) via for all simultaneously. This shows the hypothesis "pairwise" (as opposed to merely "consecutive") coprimality is exactly what is needed, and dropping it to a weaker "consecutive" version breaks the conclusion that all are distinct.
Scope, edge cases & common traps
| Situation | What actually holds | Common error |
|---|---|---|
| Has some prime factor outside the list | Assuming itself must be prime | |
| Small lists, e.g. | , prime, new | None — but doesn't illustrate the general case |
| Euler's sum | Diverges — a quantitative strengthening | Confusing with the convergent |
| Fermat numbers | Pairwise coprime, not all prime ( composite) | Assuming all are prime (Fermat's own conjecture, false) |
| Contradiction structure | Assumes finite list is complete, not just "some" primes | Misreading the theorem as being about a specific finite set only |
The mathematician behind it
Origins · 1 minEuclid of Alexandria and how this was discovered
Euclid compiled the Elements, a thirteen-book synthesis of Greek geometry and number theory that became the most influential mathematics textbook in history. Book IX, Proposition 20 contains the argument given above (phrased geometrically as "prime numbers are more than any assigned multitude of prime numbers"), presented without algebraic notation, using line segments to represent numbers. Little is known of Euclid's life; he is thought to have taught at the Library of Alexandria. His method of rigorous axiomatic-deductive proof, exemplified by this very theorem, set the standard for mathematical argument for over two millennia.
Does Euclid's proof tell us that is always prime?
No. This is the single most common misconception. The proof only guarantees that has at least one prime factor lying outside the original list ; it says nothing about whether itself is prime. In fact is frequently composite: for the list , , a product of two primes neither of which was in the original list. The theorem's content is entirely about the existence of a new prime factor, not the primality of .
Is the "first prime factor missing" always the smallest possible new prime?
Not necessarily. The construction only guarantees some prime factor of is new; it gives no control over which new prime appears or how large it is. In practice the new prime factors found this way can be much larger than the smallest prime not on the list. For example, starting from , , which happens to be prime itself and much larger than the "next" prime that was missing from the list. The proof is an existence argument, not a constructive way to find the smallest missing prime efficiently.
How does Euler's proof differ logically from Euclid's, and why have both?
Euclid's proof is combinatorial and finite in flavor: it directly exhibits a contradiction from assuming a finite complete list. Euler's proof is analytic: it shows a sum indexed by primes diverges, which is only consistent with infinitely many primes. They are logically independent — neither derives from the other — and Euler's method additionally yields the stronger quantitative fact that primes are not "too sparse" (in contrast, e.g., to squares, for which converges). Having both proofs matters because Euler's technique generalizes to prove deeper results, such as Dirichlet's theorem on primes in arithmetic progressions.
Why does the proof require the Fundamental Theorem of Arithmetic, or does it?
Euclid's proof as given only needs the weaker fact that every integer greater than has at least one prime factor (existence), which is proved directly via well-ordering and does not require full unique factorization. Euler's proof, however, genuinely needs the uniqueness part of the Fundamental Theorem of Arithmetic, to correctly enumerate the terms of the Euler product without double-counting or missing any integer with prime factors below . So the two proofs lean on different strengths of the same underlying arithmetic structure.
Can the same style of proof show there are infinitely many primes of a specific form, like ?
Yes, with modification. A Euclid-style argument shows infinitely many primes of the form : assuming finitely many such primes , form , which is of the form and must have a prime factor of the form (since a product of primes all would itself be , but ), and this factor is shown to differ from every . This is a genuine variant, but for a general modulus and residue, only Dirichlet's theorem (using genuinely analytic tools) settles the question in full — Euclid-style tricks work for special residues but not universally.
Does the infinitude of primes tell us anything about how primes are spaced?
By itself, no — infinitude alone is compatible with primes becoming extremely sparse (say, doubling in size at each step) or fairly dense. It is Euler's stronger divergence result, and later the Prime Number Theorem, that pin down the actual density: primes near occur with "probability" roughly . This finer question is the subject of Elementary Distribution of Primes, for which the infinitude theorem is a necessary first step but far from the whole story.
Is Euclid's argument constructive, i.e. does it give an algorithm to find new primes?
In a weak sense yes: given any finite list of primes, one can compute and factor it to exhibit a genuinely new prime, and this process can be iterated indefinitely. But it is a very inefficient algorithm — the numbers grow extremely fast (roughly like the product of all known primes), and factoring large is computationally expensive. In practice, no serious prime-generation algorithm uses this method; primality testing algorithms (e.g. Miller–Rabin, AKS) search directly among candidate integers instead.