how many trailing zeroes are there in 100! (100 factorial)?
Monday, December 17, 2007
Subscribe to:
Post Comments (Atom)
Interview Puzzles
how many trailing zeroes are there in 100! (100 factorial)?
Posted by
Gaurav Saxena
at
4:41 PM
Labels: puzzles, technical Interview puzzles
8 comments:
149
No sang no....think harder...u can do better ;)
No. of trailing zeroes are " 157 "
Whats the prize of correct answer :D
Oh!!! the numbers are growing bigger and bigger...there was a big prize but looks like now i'll have to make you the head of the "Pirates"(ref Pirate Pirate!!!) so that you get doomed for using google and not analytics for solving this ;)
Two?
I believe 99! has no trailing zeroes. And 100! is 100 * 99!
Sorry I was wrong in my previous response. After 5! every factorial above will have trailing zeroes. Every time a multiple of 10 appears, one more 0 is added. Every time a multiple of 5 is multiplied by an even number, one more 0 is added. And factorials are all even numbers.
There are 10 numbers ending with 5 and 9 numbers ending with 0 till 99. So that makes it 19 trailing zeroes. So I think 100! will have (at least) 21 trailing zeroes.
BTW, 100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915
608941463976156518286253697920827223758251185210916864000000000000000000000000
and it has 24 trailing zeroes! I can't account for 3 more.. ;)
answer is 24
5 and 10 will add two zeros in every
10 numbers.
so 18 zeros in 1 to 90 multiplications. 95 and 100 will add 3 zeros;
so now total becomes 21 from 1 to 100.
But 25 , 50 and 75 will add 3 zeros extra. ( reason 25 = 5 * 5 i.e two 5s. simliarly 75 = 5 * 5 * 3 , two 5s . same for 50)
so grand total = 21 + 3 = 24
Thats correct
Post a Comment