The Number of Zeros in a Factorial
Date: 10/01/98 at 15:29:31 From: jeff Subject: Large factorial problem The problem is: How many zeros come after the last non-zero digit of 20,000,000! ? We have considered all known possibilities of numbers ending in zero, including products of '5' and '2', and came up with: 2.9 with .9 repeating times ten to the sixth power zeros to compensate for any overlapping numbers in our computations. I am stumped. Can you help me?
Date: 10/01/98 at 17:31:17 From: Doctor Nick Subject: Re: Large factorial problem Hi Jeff - The number of zeros in n! is determined by summing up [n/(5^i)], where [x] = the largest integer less than or equal to x, and the sum is for i = 1,2,3,4,.... . Eventually, n/(5^i) will be less than 1, so that [n/(5^i)] = 0, and you can stop adding. For example: 40! = 815915283247897734345611269596115894272000000000 and [40/5] = 8 [40/(5^2)] = 1 [40/(5^3)] = 0 and these sum to 9 - there are 9 zeros. The idea is that each multiple of 5 between 1 and 40 contributes a zero to 40!. Multiples of 5^2 contribute another 1, multiples of 5^3 contribute yet another one, and so on. There are lots of multiples of 2 around, so it's the 5's that determine how many multiples of 10 (i.e. how many zeros) we get. Now, how many multiples of 5 are there between 1 and n? Well, if n is a multiple of 5, then there are n/5. If not, let n' be the largest multiple of 5 less than n. Then there are n'/5 multiples of 5 between 1 and n. Since n' is one of n-1, n-2, n-3, or n-4, it follows that n'/5 = [n/5]. We can show by the same sort of argument that the number of multiple of 5^2 less and n is [n/(5^2)], and so on. In your case, with n=20,000,000, we have: i [n/(5^i)] 1 4000000 2 800000 3 160000 4 32000 5 6400 6 1280 7 256 8 51 9 10 10 2 11 0 and these sum to 4,999,999. Thus, there are precisely 4,999,999 zeros after the last non-zero digit of 20,000,000!. Enjoy, - Doctor Nick, The Math Forum http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994-2015 The Math Forum