techInterview Discussion

A part of techInterview.org: answers to technical interview questions.

Your host: Michael Pryor

100 factorial

There is error in the solution.

100! = 93 326 215 443 944 200 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000

and has 143 zero
Evgeny
Monday, March 13, 2006
 
 
I'm getting this value for 100!:

100! = 93 326 215 443 944 152 681 699 238 856 266 700 490 715 968 264 381 621 468 592 963 895 217 599 993 229 915 608 941 463 976 156 518 286 253 697 920 827 223 758 251 185 210 916 864 000 000 000 000 000 000 000 000
DK
Tuesday, March 14, 2006
 
 
I'm not sure your value is correct.  100! should have 21 zeros only by my calculation.  Basically, you need the number of distinct combinations of 2x5 that can give rise to a zero at the end.  There are 20 multiples of 5 from 1 to 100, which when multiplied by any of the 50 even numbers between 1 and 100, will produce a 10.  Plus one extra one for 100, which is 2x5x2x5.  So, 100! should have 21 trailing zeros.  You've written down 24 trailing zeros.  Not sure how that can be.  May be I made a mistake?
Ashwin Kalbag Send private email
Friday, March 24, 2006
 
 
DK is correct; it indeed is 24;

Ashwin ur missing 1 fact :

25 = 5 * 5
50 = 5 * 5 * 2
75 = 5 * 5 * 3

So you failed to take into account the extra 3 5s from above
numbers which are sort of "hidden"; that makes it 24!
Rangya Send private email
Saturday, April 01, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz