Primorial Prime Calculator

Number Theory

Primorial prime classificationBoth sides prime
Primorial value2,310
p# - 12,309 (prime)
p# + 12,311 (prime)
How this was calculated
  1. The primorial p5# is the product of the first 5 primes: 2,310.
  2. One less is 2,309, which is prime.
  3. One more is 2,311, which is prime (a prime on this side is also called an Euclid prime).
  4. Classification for k = 5: both sides prime.

Multiply the first few primes together and something interesting happens one step to either side. The product of the first k primes is called the k-th primorial, written p# - so 2# = 2, 3# = 6, 4# = 30, 5# = 2,310. A primorial prime is a prime of the form p# - 1 or p# + 1, and this calculator tests both sides for any k from 1 to 10.

The plus side has a famous pedigree: Euclid's proof that there are infinitely many primes considers exactly the number p# + 1, which is divisible by none of the first k primes. When it is itself prime it is called an Euclid prime. For k = 1 to 5 the plus side is always prime (3, 7, 31, 211, 2311); the minus side is prime for k = 2, 3, 5 and 6 (5, 29, 2309, 30029).

The calculator stops at k = 10, whose primorial is 6,469,693,230 - beyond that the values outgrow the exact whole-number arithmetic a browser can guarantee, and in any case both neighbours of 10# are composite. The hunt for large primorial primes continues elsewhere with specialised software; the records run to indices in the hundreds of thousands.

The pattern across the page's range is worth stating plainly: plus-side primes at k = 1, 2, 3, 4, 5; minus-side primes at k = 2, 3, 5, 6; both at k = 5; neither from k = 7 onwards. Ten small cases already contain the whole phenomenology of the subject - early luck, a twin hit, and then the long composite silence that makes the record-sized discoveries newsworthy.

Worked examples

k = 5 - prime on both sides

(5)

Primorial prime classificationBoth sides prime
Primorial value2,310
p# - 12,309 (prime)
p# + 12,311 (prime)

k = 6 - minus side only

(6)

Primorial prime classificationMinus side only
Primorial value30,030
p# - 130,029 (prime)
p# + 130,031 (composite)

k = 4 - plus side only

(4)

Primorial prime classificationPlus side only (Euclid prime)
Primorial value210
p# - 1209 (composite)
p# + 1211 (prime)

Building the primorial

Each primorial multiplies in one more prime: 2, 6, 30, 210, 2,310, 30,030, 510,510 and so on. The growth is superexponential in k, which is why the two neighbours quickly become serious primality tests even though the construction is trivial. By k = 10 the primorial has ten digits.

Neither neighbour can share a factor with any of the first k primes - any common divisor of p# and p# +/- 1 would have to divide 1. So both neighbours are automatically free of small factors, which is what makes them plausible prime candidates and made them useful to Euclid.

Euclid primes and the infinitude proof

Euclid's argument: suppose the primes were finitely many, p1 to pk. Form N = p1 x ... x pk + 1. No pi divides N (each leaves remainder 1), so either N is prime or it has a prime factor outside the list - contradiction either way. The numbers N are the Euclid numbers, and when N itself is prime it is an Euclid prime.

A subtlety the calculator makes concrete: Euclid's proof does not need N to be prime, and usually it is not. At k = 6, p# + 1 = 30031 = 59 x 509 - composite, but its factors 59 and 509 are new primes beyond the first six, exactly as the proof promises. The sibling page on Euclid numbers explores that sequence on its own.

The minus side

Primorial primes of the form p# - 1 are known for k = 2, 3, 5 and 6 within this page's range: 5, 29, 2309 and 30029. The k = 5 case is the page's party trick - 2309 and 2311 are both prime, a twin-prime pair straddling 5# = 2,310 symmetrically. Twin primorial primes like this are rare and prized by searchers.

At k = 4 the pattern flips: 209 = 11 x 19 is composite while 211 is prime. And from k = 7 to 10 neither side is prime at all - a reminder that the early run of plus-side primes (five in a row) was luck, not law.

How large primorial primes are found

Record searches test p# +/- 1 for k in the hundreds of thousands, where the numbers have hundreds of thousands of digits. The candidates are first sieved against medium primes, then subjected to probable-prime tests, and finally - for the largest claims - full primality proofs using the special form of the number (theorems of Brillhart-Lehmer-Selfridge type exploit the known factorisation of p#).

This page's range is deliberately elementary: trial division up to the square root settles primality outright for numbers up to 6,469,693,231, so every verdict here is a proof, not a probability.

Primorials versus factorials

Primorials are the prime analogue of factorials: where n! multiplies every integer up to n, p# multiplies only the primes. The sibling concept of the compositorial (product of composites) has its own page on this site. Primorial primes likewise mirror factorial primes - primes of the form n! +/- 1 - and the two families share search techniques and record culture.

The primorial function also appears in analytic number theory: log(p#) is Chebyshev's function theta(p), whose growth rate is equivalent to the prime number theorem. A playground concept and a deep one, in the same notation.

Reading the calculator's verdicts

The four possible outcomes are: both sides prime (only k = 5 in range), plus side only (k = 1 and 4, beyond the both-prime and minus-only cases), minus side only (k = 2, 3 and 6), and neither (k = 7, 8, 9, 10). The calculator shows the primorial and both neighbours with their status so you can see the factorisation claim being made.

If you test k = 1, note the convention: 1# = 2, so the neighbours are 1 and 3 - 1 is not prime, 3 is, giving 'plus side only'. Edge cases like this are why the calculator states its verdicts explicitly rather than leaving them to the raw numbers.

Primorial primes in the OEIS and the record books

The plus-side indices giving Euclid primes and the minus-side indices giving primorial primes are catalogued as separate OEIS sequences, and both are known to run into the hundreds of thousands. Each new term is a minor event in the prime-search community, typically found by distributed sieving followed by probable-prime testing on the survivors.

The largest known examples have hundreds of thousands of digits - numbers for which 'prime' is a theorem proved by specialised software, not a fact checkable by hand or by this page. The contrast is instructive: the same definition spans arithmetic a child can verify and computations at the edge of what is feasible.

Why p# +/- 1 can still be composite

Being coprime to the first k primes only clears the small factors. 30031 = 59 x 509 fails at the 59 - a prime beyond the first six, exactly as Euclid's proof allows. Students often meet this as the correction to a misremembered version of the proof ('the product plus one is a new prime'), and the calculator's k = 6 case is the standard counterexample, small enough to check completely.

Statistically, p# +/- 1 has an enhanced chance of being prime compared with a random odd number of the same size - the small factors are pre-cleared, which multiplies the naive probability by a Mertens-type factor - but the chance still shrinks as k grows. The early run of successes is the anomaly, not the later silence.

FAQs

What is a primorial prime?

A prime of the form p# - 1 or p# + 1, where p# is the product of the first k primes.

What is 5#?

2,310 - the product 2 x 3 x 5 x 7 x 11.

Is 2311 prime?

Yes - 2311 is 5# + 1, an Euclid prime; 2309 on the minus side is prime too.

What is the largest primorial this calculator tests?

10# = 6,469,693,230, whose two neighbours are both composite.

Why does the index stop at 10?

Beyond 10# the values outgrow the exact whole-number arithmetic the browser guarantees.

What is an Euclid prime?

A prime of the form p# + 1 - the plus-side primorial primes, named for Euclid's infinitude proof.

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.
Compositorial Calculator
The compositorial of n: the product of all composite numbers up to n, the primorial's mirror image on the composite side.
Prime Number Checker
Is it prime? The verdict, the full prime factorization, the smallest factor, the divisor count and the neighbouring primes on both sides.