CalcWorldHub
Free online calculator · no signup

Prime exponent in a factorial calculator

Count how many copies of one prime divide n! without constructing the factorial.

4,000 tools
Prime exponent in a factorial calculator — Factorial argument n, Prime p and calculation method
Prime exponent in a factorial calculator: inputs and calculation method.

How to use this calculator

Count how many copies of one prime divide n! without constructing the factorial.

  1. Enter Factorial argument n, Prime p. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Calculation guide

Prime exponent in a factorial explained

Legendre’s formula counts every multiple of p in n!, then adds an extra count for multiples of p², another for multiples of p³, and so on. The sum gives the exponent of the prime p in the factorial.

Exponent of p in n!24
Exponent of p in n!: 24 in the worked scenario.

Inputs, symbols, and units

n — Factorial argument n
Factorial argument n. Enter a whole number.
p — Prime p
Prime p. Enter a whole number.

Formula and method

vₚ(n!) = ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + …; stop when pʲ > n.

For n=100 and p=5, the exponent is ⌊100/5⌋+⌊100/25⌋=20+4=24; the next term is zero because 125 exceeds 100. The input p must be prime.

A worked scenario

Factorial argument n = 100; Prime p = 5.

  • Exponent of p in n!: 24

This count is exact integer arithmetic. For a composite base, factor it into primes and take the limiting exponent across those prime factors instead.

Assumptions and edge cases

The supplied divisor must be prime; for composite divisors, the prime-power decomposition requires a different combination.

Frequently asked questions

Does it compute trailing zeros?

It gives one prime exponent; base-ten zeros use the minimum of the 2 and 5 exponents.

Can n be zero?

Yes, 0!=1 has exponent zero.

Why stop the sum?

Terms vanish once pʲ exceeds n.

How do I use the Prime exponent in a factorial calculator?

Enter Factorial argument n, Prime p. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Prime exponent in a factorial?

Factorial argument n = 100; Prime p = 5. Exponent of p in n!: 24 This count is exact integer arithmetic. For a composite base, factor it into primes and take the limiting exponent across those prime factors instead.