
100!
under the question of how many trailing zeroes there are in 100!, the answer is written as 100!
This is plainly incorrect. (doing the computation, in any language, is trivial, but here is a 20s, work it out in your head proof). First, 100! is at worst the product of 100 2digit numbers, meaning it has at most 200 digits.
Trailing zeroes will only be produced by pairs of 2's and 5's in the prime number decomposition. As 2's will largely outnumber 5's, there will be as many trailing zeroes as there are 5's in the prime number decompostion. There are 20 multiples of 5 between 1 and 100. Of these, 4 are multiples of 25. This gives a decomposition of
... * (5^1)^16 * (5^2) ^4 ... = 5^24
24 trailing zeroes
Greg Dyke
Saturday, November 6, 2004
Solution: 100! is actually a link... click it.
http://www.techinterview.org/Solutions/fog0000000150.html
Michael H. Pryor
Fog Creek Software Sunday, November 7, 2004
Recent Topics
Fog Creek Home
