Computing end-digits of large factorials

PhDorBust
Messages
141
Reaction score
0
The factorial of 1 trillion ends in many trailing zeros. Find the five digits that comes before the trailing zeros.

I know how to calculate the number of trailing zeros, but don't know what to do afterwards. This is a computational problem.
 
Physics news on Phys.org
PhDorBust said:
The factorial of 1 trillion ends in many trailing zeros. Find the five digits that comes before the trailing zeros.

I know how to calculate the number of trailing zeros, but don't know what to do afterwards. This is a computational problem.

One trillion could be either 10^12 or 10^18, depending on where you reside. Which one do you mean? See http://en.wikipedia.org/wiki/Trillion .

RGV
 
10^12, sorry.

Should it make a difference though?
 
PhDorBust said:
10^12, sorry.

Should it make a difference though?

It will make a huge difference. But, it may not make a difference in the final 5 non-zero digits.

Do you know how many trailing zeros there are in (1012)! ?
 
Last edited:
Let a = 10^12, b = n be largest n such that a/5^n is an integer.

Number of trailing zeros will be N = a/5 + a/(5^2) + a/(5^3) + ... a/(5^n) = a/(5^n) * (1 + 5 + 5^2 + ... + 5^(n-1) ) = a/(5^n) * [ 5^n - 1] / [5 - 1].

But (10^12)! / 10^N is still pretty damn large to calculate. I don't see the next step.
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top