How to find the number of trailing zeros in a factorial?

269 Views Asked by At

E.g you have to find the number of trailing zeros of 28! in base 5.

How would you go about it without writing 28! in base 5? Is there a certain step by step method?

I already wrote 28! as a product of its primes.

28! = 2^25 * 3^13 * 5^6 * 7^4 * 11^2 * 13^2 * 17 * 19 * 23

1

There are 1 best solutions below

1
On BEST ANSWER

The number of trailing zeros of an integer $n$ expressed in base-$b$ is equal to the greatest value of $k$ such that $b^k \mid n$, so in this case you need to find the greatest power of $5$ that divides $28!$.

By finding its entire prime factorisation, you've created far more work for yourself than you needed to!