Euclid-Mullin Sequence Calculator

Sequences

first 5 Euclid-Mullin terms2, 3, 7, 43, 13
product of the first 5 terms23,478
that product plus 123,479
smallest prime factor of product + 1 (the next term)53
How this was calculated
  1. Start with 2. Each Euclid-Mullin term is the smallest prime factor of one plus the product of all previous terms.
  2. Multiplying the 5 terms gives 23,478; adding 1 gives 23,479.
  3. The smallest prime factor of 23,479 is 53, which becomes the next term - the sequence is Euclid's proof of infinitely many primes turned into a generator.
  4. Unlike the Euclid numbers themselves (product of the first n primes, plus 1), the Euclid-Mullin product runs over the sequence's own previous terms, so primes appear out of order - 13 arrives before 53, and 5 only in seventh place.

This Euclid-Mullin sequence calculator generates terms of the sequence and shows you exactly how each one is found. The rule is simple: each term is the smallest prime factor of one plus the product of all the terms before it. The sequence starts 2, 3, 7, 43, 13, 53, 5. You can check the rule against those numbers: the first 5 terms multiply to 23,478, and 23,479 has smallest prime factor 53, which is the sixth term. The product of the first 7 terms is 6,221,670, and 6,221,671 is itself prime, so it becomes the eighth term whole. The calculator applies this rule term by term and reports the answer along with the arithmetic behind it.

This is the accepted standard method for the calculation because it is the definition of the sequence itself: there is no shortcut or approximation involved, only the smallest prime factor of one plus the running product, computed in order. The results can be surprising, since primes arrive out of order. The term 13 comes before 53, and 5 appears only in seventh place. The sequence is Euclid's proof of infinitely many primes turned into a generator, and it was studied by Mullin in 1963. This page shows the formula, step-by-step workings, worked examples and sources so you can follow every term from the rule to the result.

Worked examples

First 5 terms

(0 - first k terms · 5)

first 5 Euclid-Mullin terms2, 3, 7, 43, 13
product of the first 5 terms23,478
that product plus 123,479
smallest prime factor of product + 1 (the next term)53

First 7 terms

(0 - first k terms · 7)

first 7 Euclid-Mullin terms2, 3, 7, 43, 13, 53, 5
product of the first 7 terms6,221,670
that product plus 16,221,671
smallest prime factor of product + 1 (the next term)6,221,671

The 4th term

(1 - a single term · 4)

Euclid-Mullin term number 443
product of the first 3 terms42
that product plus 143
its smallest prime factor43

What is the Euclid-Mullin sequence?

The Euclid-Mullin sequence is a list of primes built one term at a time by a simple rule: each new term is the smallest prime factor of one plus the product of all the terms before it. Start with 2. Multiply the terms you have, add 1, and find the smallest prime that divides the result. That prime becomes the next term, and the process repeats. The sequence begins 2, 3, 7, 43, 13, 53, 5, and it can be extended indefinitely in principle, though the terms quickly become hard to compute.

Walking through the first five terms shows how the rule works. The first term is 2. One plus the product of the terms so far gives 2 + 1 = 3, whose smallest prime factor is 3, so 3 is second. Next, 2 × 3 = 6, and 6 + 1 = 7, which is prime, so 7 is third. Then 2 × 3 × 7 = 42, and 42 + 1 = 43, again prime, so 43 is fourth. Finally, 2 × 3 × 7 × 43 = 1,806, and 1,806 + 1 = 1,807, whose smallest prime factor is 13, making 13 the fifth term.

The next step connects the first five terms to the sixth. Those first 5 terms multiply to 23,478, and 23,479 has smallest prime factor 53, so 53 is the sixth term. The pattern continues in surprising ways: the product of the first 7 terms is 6,221,670, and 6,221,671 is itself prime, so it becomes the eighth term whole rather than being split into smaller factors.

One of the most striking features is that the primes arrive out of order. If the sequence simply listed every prime in increasing order, 5 would appear early, but here 13 comes before 53, and 5 only in seventh place. Larger primes can jump ahead of smaller ones depending on which factor happens to divide the product-plus-one first.

The rule is really Euclid's classic proof of infinitely many primes turned into a generator. Euclid argued that multiplying any finite collection of primes and adding 1 produces a number with a prime factor not in that collection; the Euclid-Mullin sequence applies that idea step by step, always taking the smallest such factor. The construction was studied by Mullin in 1963, and it remains a favorite example of how a short, deterministic rule can produce a list that looks unpredictable.

First terms: 2, 3, 7, 43, 13, 53, 5 — each is the smallest prime factor of one plus the product of all earlier terms.

How each term is computed

To see how the Euclid-Mullin sequence builds itself, follow a single step closely. The rule is always the same: take every term computed so far, multiply them together, add one, and then find the smallest prime that divides that new number. That smallest prime factor becomes the next term. Walking through the transition from 23,478 to 53 shows the whole mechanism in three short moves.

First, the running product. The first five terms of the sequence are 2, 3, 7, 43 and 13. Multiply them all together: 2 × 3 × 7 × 43 × 13 = 23,478. This product is the running total carried into the next step — it is not itself a term of the sequence, just the accumulated value of everything so far.

Second, the plus-1 step. Add one to the running product: 23,478 + 1 = 23,479. This number is the candidate whose prime factors will decide the next term. It is always one more than a multiple of every earlier term, which is exactly why it cannot share a prime factor with any of them.

Third, the smallest-prime-factor step. Factor 23,479 and look for the smallest prime that divides it. That smallest prime factor is 53, so 53 becomes the sixth term of the sequence. Notice that 53 is larger than some earlier terms but smaller than others — the terms do not climb in order, which is why the running product must be tracked carefully at every step.

The same three moves repeat forever. Later, after the first seven terms are multiplied to 6,221,670, adding one gives 6,221,671, and that number is itself prime, so it enters the sequence whole as the eighth term. The Euclid-Mullin sequence is Euclid's proof of infinitely many primes turned into a generator, studied by Mullin in 1963, and every new term comes from this identical product-plus-one-and-smallest-factor routine.

  • Running product: 2 × 3 × 7 × 43 × 13 = 23,478
  • Plus-1 step: 23,478 + 1 = 23,479
  • Smallest-prime-factor step: the smallest prime factor of 23,479 is 53, so 53 is the sixth term
Each term is the smallest prime factor of one plus the product of all previous terms — here, 23,478 plus 1 gives 23,479, whose smallest prime factor is 53.

Why the primes are out of order

The Euclid-Mullin sequence looks like it should be a tour of the primes in order, but it is not. The reason is what gets multiplied. Each new term is the smallest prime factor of one plus the product of all previous terms in the sequence itself — not one plus the product of the first n primes. That single difference separates the Euclid-Mullin sequence from the classic Euclid numbers and explains why small primes show up late, large primes show up early, and the order looks scrambled.

The first terms make the mechanism concrete. Starting from 2, the next term is the smallest prime factor of 2 + 1 = 3, which is 3 itself. Then 2 × 3 + 1 = 7, already prime, so 7 is next. Then 2 × 3 × 7 + 1 = 43, also prime. Then 2 × 3 × 7 × 43 + 1 = 1807, and its smallest prime factor is 13 — a smaller prime than 43, arriving after it. The sequence runs 2, 3, 7, 43, 13, 53, 5.

The fifth-to-sixth step shows the same effect with bigger numbers. The first 5 terms multiply to 23,478, and 23,479 has smallest prime factor 53, so 53 becomes the sixth term. The product of the first 7 terms is 6,221,670, and 6,221,671 is itself prime, so it becomes the eighth term whole — no factoring needed, and a very large jump in size.

Primes arrive out of order throughout: 13 comes before 53, and 5 only in seventh place. None of this is a flaw in the rule; it is what the rule produces. The sequence is Euclid's proof of infinitely many primes turned into a generator, studied by Mullin in 1963. Euclid's argument only needs some new prime to exist at each step; the sequence insists on the smallest one, and the smallest one depends on the accumulated product of the sequence's own terms.

TermValueRunning product of terms so far
122
236
3742
4431806
51323,478
6531,244,334
756,221,670
The product runs over the sequence's own terms, not the first n primes — that is why the primes come out of order.

The open question

The Euclid-Mullin sequence is simple to write down and surprisingly hard to pin down. Each term is the smallest prime factor of one plus the product of all previous terms. That rule is short enough to state in a sentence, yet it produces a list whose long-term behavior nobody can fully predict. The sequence starts 2, 3, 7, 43, 13, 53, 5, and after that the terms grow and jump in ways that resist easy description.

The central open question is whether every prime eventually appears somewhere in the sequence. No one knows. It is not known whether some primes are skipped forever, and it is not known whether all of them show up. This is the kind of gap that makes the Euclid-Mullin sequence a favorite example of a problem that looks elementary but has resisted analysis. The definition involves only multiplication and factoring, but the numbers involved explode in size, and the smallest-prime-factor step gives the sequence a chaotic feel.

Small cases show how the sequence can surprise you. The first 5 terms multiply to 23,478, and 23,479 has smallest prime factor 53, which becomes the sixth term. The product of the first 7 terms is 6,221,670, and 6,221,671 is itself prime, so it becomes the eighth term whole — a term far larger than its neighbors. Primes also arrive out of order: 13 comes before 53, and 5 only appears in seventh place. A prime's position in the sequence tells you nothing about its size.

The sequence is Euclid's proof of infinitely many primes turned into a generator, studied by Mullin in 1963. Euclid's argument shows that multiplying finitely many primes and adding one produces a number with a new prime factor. The Euclid-Mullin sequence turns that existence proof into a concrete recipe by always taking the smallest such factor. Turning a proof into a generator, however, does not make the generated list easy to analyze.

What makes the open question so stubborn is the combination of a deterministic rule with unpredictable outputs. Every term is fixed by the ones before it, so there is no randomness in the definition. Yet the sizes of the terms and the primes that appear do not follow an obvious pattern, and proving statements about all future terms would require understanding factorizations of enormous numbers. For now, whether every prime eventually appears remains unknown.

Open question: it is unknown whether every prime eventually appears in the Euclid-Mullin sequence.

FAQs

What are the first 7 Euclid-Mullin terms?

The first 7 Euclid-Mullin terms are 2, 3, 7, 43, 13, 53, and 5. Each term is the smallest prime factor of one more than the product of all previous terms. Notice that the terms are not in increasing order, since 13 and 5 appear after 43.

What is the 4th Euclid-Mullin term?

The 4th Euclid-Mullin term is 43. The product of the first 3 terms is 2 × 3 × 7 = 42, and one more than that is 43, which is prime. So 43 is the smallest prime factor of 43 and becomes the fourth term.

How is the Euclid-Mullin sequence different from Euclid numbers?

Euclid numbers multiply the first n primes together. Euclid-Mullin multiplies the sequence's own previous terms instead. Because of that difference, the primes in the Euclid-Mullin sequence appear out of order, while Euclid numbers build directly on the primes in their usual order.

What is the product of the first 7 terms?

The product of the first 7 terms is 6,221,670. One more than that is 6,221,671, which is prime. So the next term in the sequence is the smallest prime factor of 6,221,671, and since that number is itself prime, the next term is 6,221,671.

Does every prime appear in the Euclid-Mullin sequence?

Nobody knows. Whether every prime appears in the Euclid-Mullin sequence is an open problem, meaning it has not been proven either way. Mathematicians have not established that all primes show up, nor that some prime never does.

Why does the sequence prove there are infinitely many primes?

Each term is a prime that does not divide the product of the previous terms. So no finite list can ever be complete: from any list you can always produce a new prime. This is Euclid's argument, applied step by step to the sequence's own previous terms rather than to the first n primes.

Sources

Related calculators

Euclid Number Calculator
Compute the Euclid number E(n) - the product of the first n primes plus 1 - with its primorial, factorization and digit count.
Arithmetic Derivative Calculator
Compute the arithmetic derivative D(n) from the prime factorization using the Leibniz product rule.
Blum Integer Calculator
Test whether a number is a Blum integer - the product of exactly two distinct primes, both 3 mod 4 - with the factorisation, the residues mod 4 and the next Blum integer.