tag:blogger.com,1999:blog-32064785.post1596881850778296057..comments2024-03-29T15:16:22.263+05:30Comments on Freshers Interviews: Last Non Zero Digit of Factorialchaitanyahttp://www.blogger.com/profile/05855949584266440305noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-32064785.post-55374031121979007372011-06-22T20:37:36.054+05:302011-06-22T20:37:36.054+05:30what if n is of order 10^100what if n is of order 10^100Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-32064785.post-89890514262536956912010-10-03T12:20:15.209+05:302010-10-03T12:20:15.209+05:30The general equation presented is K = X + nZeros(n...The general equation presented is K = X + nZeros(n!). But nZeros(1000!) = 249, as calculated in the other post, not 5. <br /><br />Could you explain this better, plz?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-32064785.post-65315518830237572092010-05-02T04:41:11.898+05:302010-05-02T04:41:11.898+05:30Actually it's even easier to do, you just have...Actually it's even easier to do, you just have to check how many multiples of 5 has N and that's the number of zeros the factorial will have...<br /><br />For example, if you want the factorial of 27, you know that 27! = 27*26*25*23*...*1, whenever you multiply a multple of 5 (25, 20, 15, 10 and 5 in this case) by any even number the result in a multiple of 10, adding an extra 0 to the count.<br /><br />In fact 10 and 20 are already multiples of 10, so they add the extra 0 when they get multiplied.<br /><br />Because of this you can calculate the number of multiples of 5 (int zeros = n / 5;), resulting in the number of zeros the factorial will have, so you'll have to trace zeros+1 numbers of the factorial.<br /><br />In fact you could simply divide by ten every time you passed a multiple of 5 and you wouldn't have to trace more than 2 digitsAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-32064785.post-46285580112037376072008-10-14T09:30:00.000+05:302008-10-14T09:30:00.000+05:30We could find the last k non-zero digits of factor...We could find the last k non-zero digits of factorial quickly at the link http://zdu.spaces.live.com/blog/cns!C95152CB25EF2037!125.entry.Zhaohuihttps://www.blogger.com/profile/02448241621854635257noreply@blogger.comtag:blogger.com,1999:blog-32064785.post-61596859917459479702008-03-14T19:18:00.000+05:302008-03-14T19:18:00.000+05:30can you come up with some clear idea of how u sayi...can you come up with some clear idea of how u saying that maximum number of zeros possible is 5. ie how you choosing 5^6 and not more than 6.Pradeephttps://www.blogger.com/profile/15129294046913245378noreply@blogger.com