How to use this calculator
Count how many copies of one prime divide n! without constructing the factorial.
- Enter Factorial argument n, Prime p. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
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.
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.
Read our calculation methodology.