Euclid Number Calculator
Term
- Euclid numbers are built from the primorial: multiply the first n primes together and add 1, the construction at the heart of Euclid's proof that the primes never end.
- The first 3 primes are 2, 3, 5, and their primorial product is 30.
- Adding 1 gives the Euclid number E(3) = 30 + 1 = 31.
- E(3) is coprime to every one of the first 3 primes, and factoring it gives: prime.
The Euclid number calculator computes E(n), the product of the first n primes plus 1. Enter n and the tool multiplies the first n primes in order, adds 1, and shows you the resulting Euclid number. Small inputs give familiar results: E(3) = 2 x 3 x 5 + 1 = 31, which is prime, and E(4) = 210 + 1 = 211, which is also prime. The pattern does not continue forever. E(6) = 30,030 + 1 = 30,031 = 59 x 509, the first Euclid number that is composite. The calculator shows both the number and whether it factors, so you can see exactly where primality stops holding.
This is the standard way to compute a Euclid number because the definition itself is that direct recipe: take the first n primes, multiply them, add 1. There is no shortcut or estimate involved, and nothing about the result depends on how the calculation is arranged, so the product-plus-one method is the accepted approach for this kind of calculation. The page goes beyond a single answer. It presents the formula, step-by-step workings, worked examples such as E(3), E(4) and E(6), and sources. Every Euclid number is coprime to the first n primes, which is the engine of Euclid's proof that the primes are endless, so the same calculation that gives you a number also illustrates one of the oldest arguments in mathematics.
Worked examples
E(3) = 31, prime
(3)
| Euclid number E(n) | 31 |
| Primorial (product of the first n primes) | 30 |
| Factorization of E(n) | Prime |
| Digits in E(n) | 2 |
E(4) = 211, prime
(4)
| Euclid number E(n) | 211 |
| Primorial (product of the first n primes) | 210 |
| Factorization of E(n) | Prime |
| Digits in E(n) | 3 |
E(6) = 30031, composite
(6)
| Euclid number E(n) | 30,031 |
| Primorial (product of the first n primes) | 30,030 |
| Factorization of E(n) | 59 x 509 |
| Digits in E(n) | 5 |
Euclid's construction
An Euclid number calculator is built on one of the oldest and simplest constructions in mathematics. Take the first n primes, multiply them all together, and add 1. That result is the Euclid number E(n). The product of the first n primes is sometimes called a primorial, so you can think of a Euclid number as a primorial plus one. The idea is easy to state and surprisingly powerful, which is why it has survived for more than two thousand years.
Small cases show how the construction behaves. For n = 3, the first three primes are 2, 3 and 5. Their product is 30, and adding 1 gives E(3) = 2 x 3 x 5 + 1 = 31, which is prime. For n = 4, the product of the first four primes is 2 x 3 x 5 x 7 = 210, so E(4) = 210 + 1 = 211, which is also prime. It is tempting to guess that this always happens, but it does not. For n = 6, the first six primes multiply to 30,030, and E(6) = 30,030 + 1 = 30,031 = 59 x 509. That makes E(6) the first Euclid number that is composite.
The reason the construction matters is not that E(n) is always prime. It is what the plus-one step guarantees about divisibility. Every Euclid number is coprime to the first n primes. To see why, suppose you divide E(n) by any one of those primes. The primorial part divides evenly, so the division leaves a remainder of exactly 1. A remainder of 1 means that prime cannot divide E(n). Since this holds for each of the first n primes, none of them shares a factor with E(n).
That coprimality is the engine of Euclid's proof that the primes are endless. Imagine, for the sake of argument, that there were only finitely many primes, and list them as the first n primes. Form E(n) from that complete list. By the argument above, E(n) is coprime to every prime on the list, so none of them divides it. But every whole number greater than 1 has at least one prime factor. That factor would have to be a prime not on the list, contradicting the claim that the list was complete. So no finite list can contain all the primes, and the primes are endless.
Notice what the proof does and does not require. It does not require E(n) itself to be prime; E(6) shows that it need not be. It only requires that E(n) has some prime factor outside the first n primes. In the n = 6 case, the new primes are 59 and 509, neither of which appears among 2, 3, 5, 7, 11 and 13. The construction therefore always points beyond any finite starting list, which is exactly the point Euclid needed.
The first Euclid numbers
The first Euclid numbers are small enough to check by hand, which makes them a good place to see the definition at work. The Euclid number E(n) is the product of the first n primes, plus 1. Start with the first three primes — 2, 3 and 5 — multiply them, and add 1. That gives E(3) = 2 x 3 x 5 + 1 = 31, which is prime. The next case steps up by one prime: E(4) = 210 + 1 = 211, which is prime as well. So the first two Euclid numbers you meet when you begin at n = 3 are both primes themselves.
The pattern does not hold forever. The first Euclid number that is composite is E(6). Multiplying the first six primes gives 30,030, and adding 1 gives 30,031. Unlike 31 and 211, this number factors: E(6) = 30,031 = 59 x 509. That single example is enough to show that the "plus 1" step does not guarantee a prime result, even though it does produce a prime in the two smaller cases above.
A useful way to read these results is through the property that drives Euclid's argument. Every Euclid number is coprime to the first n primes. In other words, when you divide E(n) by any of those primes, the remainder is always 1, because E(n) is exactly one more than a multiple of each of them. That is why the factor 59 in E(6) is not one of the first six primes — it has to come from somewhere new. The same reasoning is the engine of Euclid's proof that the primes are endless: from any finite list of primes you can build a number that none of them divides, so the list can always be extended.
For a quick reference, the table below lists the three early Euclid numbers covered here with their factorizations. If you want to check more cases, a euclid number calculator applies the same definition — multiply the first n primes, add 1, then test or factor the result — so you can confirm these entries and explore what happens as n grows.
| Euclid number | Product of first n primes, plus 1 | Value | Factorization |
|---|---|---|---|
| E(3) | 2 x 3 x 5 + 1 | 31 | 31 (prime) |
| E(4) | 210 + 1 | 211 | 211 (prime) |
| E(6) | 30,030 + 1 | 30,031 | 59 x 509 (composite) |
Prime or composite?
Euclid's construction is often described as a way to build new primes, and that phrasing can mislead. What the construction actually guarantees is a new prime factor, not a prime. The Euclid number E(n) is the product of the first n primes, plus 1. Multiplying those primes together and adding 1 ensures the result shares no factor with any of them: dividing by any of the first n primes leaves a remainder of 1. So whatever factors E(n) has, at least one of them must be a prime outside that starting list. That is the engine of Euclid's proof that the primes are endless, and it is the fact a euclid number calculator is really built to illustrate.
Small cases make the construction look like a prime factory. E(3) = 2 x 3 x 5 + 1 = 31, which is prime. E(4) = 210 + 1 = 211, which is prime. Two prime results in a row can easily leave the impression that the method always produces primes. It does not. The guarantee is about new prime factors, and a number can carry new prime factors while still being composite itself.
The classic counterexample is E(6) = 30,030 + 1 = 30,031 = 59 x 509. This is the first Euclid number that is composite, and it is the example worth keeping in mind. Notice what the construction still delivers: 59 and 509 are both primes, and neither appears among the first six primes (2, 3, 5, 7, 11, 13) that were multiplied together. The proof's promise holds exactly as stated. A new prime factor appears. The number 30,031 simply is not itself one of them.
That distinction is the heart of the "Prime or composite?" question for any Euclid number. The construction rules out the first n primes as factors, but it says nothing about how many factors remain or how large they are. A Euclid number could be prime, or it could be a product of two or more primes that were not on the original list. Only checking the number itself settles which case you are in.
When you use the calculator, treat the output as two separate pieces of information. One is the value of E(n). The other is its factorization, which tells you whether that value is prime or composite. The factorization is where the proof becomes visible: you can see the new prime factors that the construction forced into existence, even when the Euclid number as a whole is composite. E(6) shows both sides at once: a composite result, and two fresh primes that were not among the first six.
Primorials and Euclid primes
A primorial is the product of the first n primes, and it is the building block behind every Euclid number. The Euclid number E(n) is that primorial plus 1. So E(3) means multiplying the first three primes — 2, 3 and 5 — and adding 1: 2 x 3 x 5 + 1 = 31. The same recipe scales to any n, which is why a euclid number calculator can generate these values quickly once you know how many primes to include.
The interesting question is whether the result is prime or composite, and the answer varies from one n to the next. E(3) = 31, which is prime. E(4) = 210 + 1 = 211, which is also prime. The pattern does not hold forever, though. E(6) = 30,030 + 1 = 30,031, and 30,031 factors as 59 x 509 — the first Euclid number that is composite. That example is a useful reminder that adding 1 to a primorial does not guarantee a prime; it only guarantees a number that shares no factor with the primes you multiplied.
When a Euclid number does turn out to be prime, it is called a Euclid prime. E(3) and E(4) are therefore Euclid primes, while E(6) is not. The name applies only to the prime outcomes, not to every number of the form primorial plus 1. Because the values grow extremely fast, the composite cases quickly become hard to check by hand, and factoring them can require real computational effort. That is where a euclid number calculator earns its keep: it handles the multiplication and the primality check so you can focus on the structure of the result.
The reason these numbers matter goes back to Euclid's proof that the primes are endless. Every Euclid number is coprime to the first n primes — that is, it shares no common factor greater than 1 with any of them. If you divide E(n) by any of those primes, you get a remainder of 1. That fact is the engine of the proof: whatever E(n) turns out to be, prime or composite, its prime factors cannot be among the first n primes, so there must be a prime beyond them. The composite case of E(6) illustrates this neatly — 59 and 509 are both outside the first six primes.
Put together, primorials and Euclid primes show how a simple construction can produce both easy primes and stubborn composites. Working through a few examples by hand builds intuition, but the numbers climb fast. A calculator lets you jump to larger n and see for yourself which Euclid numbers are prime and which split into factors.
FAQs
What is a Euclid number?
A Euclid number is the product of the first n primes plus 1. For example, with n = 3, the first three primes are 2, 3 and 5. Their product is 30, and adding 1 gives E(3) = 31. This construction is named after the ancient Greek mathematician Euclid.
What is E(6)?
E(6) is 30,031. It is built from the first six primes, whose product plus 1 equals that value. Unlike some smaller Euclid numbers, E(6) is not prime: it factors as 59 x 509. Both 59 and 509 are primes, and neither appears among the first six primes used to build it.
Are all Euclid numbers prime?
No. E(6) = 30,031 is composite, factoring as 59 x 509. The construction only promises that any prime factor lies outside the first n primes; it does not promise the number itself is prime. So a Euclid number can be prime or composite, and you must check each one separately.
What is a primorial?
A primorial is the product of the first n primes, written p#. It is the number you get before adding 1 to form a Euclid number. For E(6), the primorial inside it is 30,030, and adding 1 gives 30,031. So the Euclid number is always the primorial plus 1.
Why did Euclid invent this construction?
Euclid used it to prove there are infinitely many primes. The argument: take any finite list of primes, multiply them together and add 1. The resulting number has a prime factor that is not on the list. Since every finite list can be extended this way, no finite list contains all primes.
What is the largest known Euclid prime?
Euclid primes are known for sizeable n, but most Euclid numbers tested turn out composite, like E(6) = 30,031, which factors as 59 x 509. Because composite results are common, prime Euclid numbers become harder to find as n grows, and only some values of n produce them.