How many digits do I really have?

Determine the number of digits of 10 , 000 , 000 ! 10,000,000! .

Details and Assumptions

It is 10 million factorial.

You may use the following approximation:
log 10 2 = 0.30102999566398 \log_{10} 2 = 0.30102999566398 \ldots
log 10 π = 0.49714987269413 \log_{10} \pi = 0.49714987269413 \ldots
log 10 e = 0.43429448190325 \log_{10} e = 0.43429448190325 \ldots


The answer is 65657060.

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.

2 solutions

Discussions for this problem are now closed

Ariel Gershon
Mar 12, 2015

We can use Stirling's Approximation: 2 π n ( n e ) n n ! e n ( n e ) n \sqrt{2\pi n} \left(\frac{n}{e}\right)^n \le n! \le e\sqrt{n} \left(\frac{n}{e}\right)^n Now take the log (base 10) of all these expressions: 1 2 log ( 2 π ) + 1 2 log n + n ( log n log e ) log n ! log e + 1 2 log n + n ( log n log e ) \frac{1}{2}\log{(2\pi)} + \frac{1}{2}\log{n} + n\left(\log{n} - \log{e}\right) \le \log{n!} \le \log{e} + \frac{1}{2}\log{n} + n\left(\log{n} - \log{e}\right) Now if we substitute n = 1 0 7 n = 10^7 and the values given, we get the following: 6567059.08 log n ! 6567059.12 6567059.08 \le \log{n!} \le 6567059.12 6567060 log n ! + 1 6567060 6567060 \le \lfloor \log{n!} \rfloor + 1 \le 6567060 Now the formula for the number of digits in n ! n! is exactly log n ! + 1 \lfloor \log{n!} \rfloor + 1 . Therefore, the number of digits in 1 0 7 ! 10^7! is 6567060 \boxed{6567060} .

Sir, any simple proof for Stirling Apporoximation please ?

Venkata Karthik Bandaru - 6 years, 2 months ago

Great solution, I came upon this approximation but couldn't solve it. Just a question. Isn't log n ! + 1 \lfloor \log{n!} \rfloor + 1 \ = to log n ! \lceil \log{n!} \rceil \ ?

David Holcer - 6 years, 2 months ago

Not true for n = 0 , 1 n=0,1 . But it works for n = 2 , 3 , n=2,3,\ldots because n ! n! is not a perfect power of 10 10 .

Pi Han Goh - 6 years, 2 months ago

At first I tried to approximate the given factorial into an integral after taking logarithm (since 1 0 7 10^7 is very large). But I was off by 4 4 , since the approximation wasn't good enough. So I kind of cheated and got the answer using a C++ code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include<fstream.h>
#include<conio.h>
#include<math.h>
#include<iomanip.h>

int main()
    {
    double s=0;
    for(double i=2;i<=10000000;i++)
        s+=log(i);
    cout<<setprecision(15)<<floor((s/log(10))+1);
    getch();
    return 0;
    }

Is there any other way to do this other than the solutions already mentioned here?

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...