Zeros at the end of a factorial

What is the prime number which has exactly 1 billion zeros at the end of its factorial? As an example, the prime number 523 factorial has 128 zeros at the end.


The answer is 4000000019.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Anthony Ritz
Feb 19, 2016

Since a zero digit means a factor of ten, and since there are many more twos available than there are fives, counting zeroes really means counting fives.

Every fifth number gives a factor of five, every twenty-fifth gives an extra five, every one hundred and twenty-fifth gives and extra extra five, and so forth. So the number of factors of five we find before an integer x is simply the sum of x 5 + x 5 2 + x 5 3 + . . . \frac{x}{5}+\frac{x}{5^{2}}+\frac{x}{5^{3}}+... , truncating any non-integer term.

This sum is slightly below the sum of the infinite geometric series, which will be x 5 1 1 5 = x 4 \frac{\frac{x}{5}}{1-\frac{1}{5}}=\frac{x}{4} . So our number must be just over 4 , 000 , 000 , 000 4,000,000,000 .

Specifically, repeatedly dividing 4 , 000 , 000 , 000 4,000,000,000 by 5 5 and summing shows that we're three fives short (there is probably a better way here, but I'm only seeing the brute force right now).

So the answer must be between 4 , 000 , 000 , 015 4,000,000,015 and 4 , 000 , 000 , 019 4,000,000,019 , inclusive. However, 4 , 000 , 000 , 015 4,000,000,015 is a multiple of five, 4 , 000 , 000 , 017 4,000,000,017 is a multiple of three, and the evens are obviously not prime, so the answer must be 4 , 000 , 000 , 019 \boxed{4,000,000,019} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...