Primorial Calculator

Find the primorial of a number.

Result

30,030
6

How it is calculated

The tool walks through every integer from 2 up to n, tests each one for primality by trial division, and multiplies together the ones that are prime: n# = ∏ p over all primes p ≤ n. It also reports how many primes were multiplied. The input is cut to a whole number and must lie between 1 and 40; anything outside that range returns no result. For n = 1 there are no primes, so the product is the empty product, 1. The result only changes when n reaches a new prime, so 13# and 16# are the same number.

Worked example

Enter n = 13. The primes up to 13 are 2, 3, 5, 7, 11 and 13, which is 6 primes. Multiply step by step: 2 × 3 = 6, × 5 = 30, × 7 = 210, × 11 = 2,310, × 13 = 30,030. The primorial 13# is 30,030, built from 6 primes.

Try this example →

Common mistakes

  • Multiplying all integers up to n. That is the factorial; the primorial skips composites, so 13# is 30,030 while 13! is over six billion.
  • Expecting the value to change at every step of n. It only jumps at primes, so 14, 15 and 16 give the same answer as 13.
  • Entering a decimal or a value above 40. Decimals are cut to a whole number and values above 40 or below 1 give no result.
  • Counting 1 as a prime. It is not, so it contributes nothing and the prime count for n = 1 is 0.

About this calculator

The primorial of n, written n#, is the product of all prime numbers less than or equal to n — analogous to the factorial but multiplying only primes. For example 10# = 2 × 3 × 5 × 7 = 210 (the primes up to 10). Primorials grow extremely fast, even faster than factorials of the same argument once several primes are included, since every factor is itself prime rather than a run of consecutive integers.

Primorials show up throughout number theory: Euclid's classic proof that there are infinitely many primes considers a number one more than a primorial (p# + 1), and "primorial primes" (primes of the form p# ± 1) are an active area of prime-hunting research. They're also used to construct numbers with many small prime factors for testing purposes, and in the study of prime gaps and the distribution of primes via the prime-counting function. Students and number-theory hobbyists use this calculator to compute n# for any n and explore these patterns.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators