
Trailing zeros
The given solution to the trailing zeros problem is very poorly written. First, he means "multiples," not "factors." But anyway, what's the point in counting multiples of 10? The point is this: 100! = 2^m * 5^n * x.
The number of trailing zeros will be min(m, n), and as he states, n < m ("there are more than enough twos"), so we just need to find the greatest power of 5 that divides 100!:
20 multiples of 5^1
4 multiples of 5^2
20 + 4 = 24
Aditya K. Prasad
Wednesday, July 14, 2004
Recent Topics
Fog Creek Home
