Formula
Exponent of a prime in (Legendre's formula)
Arithmetic • Number System • Factors and Divisors
Formula
For a prime and a positive integer , the exponent of in the prime factorisation of is , the sum stopping as soon as .
How to use it
- 1The number of trailing zeros of is the exponent of alone, because the s always run out before the s.
- 2For the largest power of a composite dividing , apply the formula to each prime of and take the smallest of the results after dividing by that prime's multiplicity in .
- 3Each term counts one extra factor for the multiples of the next power, which is why contributes two s and three.
Worked example
In how many zeros does end?
Step-by-step
- 1zeros exponent of in
Why: A trailing zero needs a and a , and holds far more s than s.
- 2
Why: , so the sum stops after two terms.
Answer
Watch out
Counting only the multiples of misses the extra factors hidden inside , , — the commonest error. And the exponent of is the SMALLER of the exponents of and , never their sum.
Builds on
Also known as
Legendre's formula, trailing zeros of a factorial, highest power of a prime dividing n factorial, number of zeros at the end of n!, de Polignac's formula, largest power of 10 dividing a factorial