Arithmetic · 8 min
Highest power of a prime in n!
Lesson
Write the prime, then keep dividing n by that prime, by its square, by its cube, and add the whole-number parts. For 10^k or trailing zeros, use 5. For 4, 8 or 12, convert to primes first and take the tightest limit.
Remember these
The highest power of a prime p that divides n! is floor(n/p) + floor(n/p²) + floor(n/p³) + … until the powers exceed n. You are counting how many multiples of p, of p², of p³ and so on lie at or below n. The same count for p = 5 gives the number of trailing zeros in n! written in base 10, because zeros come from factors of 10, and there are almost always fewer fives than twos.
For a composite number, first write it as a product of primes. The highest power of 6 = 2 × 3 is limited by the scarcer prime, which is 3. The highest power of 4 = 2² is the power of 2 in n!, divided by 2 and then taken as a whole number. Do not stop after the first term floor(n/p); the higher powers still add more.
Why the paper asks this
SSC, RRB and bank quantitative papers ask this as a short direct item, often with 100! or trailing zeros.
Worked example
Highest power of 5 in 100! is 20 + 4 = 24, which is also the number of trailing zeros in 100!.
Common trap
Stopping at 100/5 = 20 and forgetting 100/25 = 4, or treating the power of 4 in n! as the same as the power of 2.
Source: NCERT mathematics and the SSC, RRB, TSLPRB and banking quantitative syllabi; written in our own words
Sign up to continue learning
This lesson is free to read. Sign up free to open the next lesson in the app, keep your progress, and practise questions on this topic.
Sign up to continue learning