



 
Hi Mukesh, Here is a suggestion. I am not sure if this is exactly what you want, but it might help get you started. First write n! as 2^{a} x 5^{b} x t, where t is divisible by neither 2 nor 5. The exponent of any prime in the prime factorization of n! is known to be the sum from i=1 to infinity of the floor of n/p^{i}, so it is possible to compute a and b. Notice that once p^{i} exceeds n all remaining tems in the sum are zero. Let m be the minimum of a and b. The integer n! ends with a sequence of m zeros. The last nonzero digit of n! is n! modulo 10^{m+1}. The two digits preceding the sequence of m zeros are given by n! modulo 10^{m+2}. There is a small problem though, the leftmost of these two digits could be a zero. In general the K digits preceding the final sequence of m zeros of n! are given n! modulo 10^{m+K}, but there is no reason why some of these cannot be zero (except for the last). I don't know how often there is a zero among them. Papers written by Peter Borwein might be a good place to look for better ideas than these. Victoria  


Math Central is supported by the University of Regina and The Pacific Institute for the Mathematical Sciences. 