Estimate number of digits of 333!

619 Views Asked by At

How do I estimate the number of digits of 333! in a rigorous way?

What I did so far is just counting in the following manner: 1 digit for the first 99 numbers and then 2 digits for the remaining 234 numbers of 333!. This sums up to approx. 567 digits. Which is very rough compared to 698 digits which is the real solution.

Any other suggestions?

3

There are 3 best solutions below

5
On BEST ANSWER

Stirling's approximation $$n!\sim\sqrt{2\pi n}\left(\frac{n}{e}\right)^n$$ is spooky accurate. Take the (base-10) log of both sides, and you get $$\log n!\approx \frac{1}{2}(\log(2\pi)+\log n)+n(\log n-\log e)$$ $$= \frac{1}{2}\log(2\pi)-n\log e+\left(n+\frac{1}{2}\right)\log n$$ $$\approx 0.4-.43n+\left(n+\frac{1}{2}\right)\log n$$

Plugging $n=333$ into it, I get $698.45+$

0
On

What we want is the (integer part of) the value of $$ \log_{10}1 + \log_{10}2 + \cdots + \log_{10}333 + 1 $$ You found an approximation by assuming that every number in this sum below $\log_{10}100 = 2$ was equal to $1$, and every number $2$ or higher was equal to $2$. This will, as you have found, underestimate the true answer.

I think it would be one step better to round each of the numbers in the sum above to its closest integer instead, rather than rounding most of them down. Since $\sqrt{10} \approx 3.16$, that means that $\log_{10}3$ gets rounded down to $0$, everything from $\log_{10}4$ to $\log_{10}31$ gets rounded to $1$, everything from $\log_{10}32$ to $\log_{10}316$ gets rounded to $2$, and the remaining few get rounded to $3$. This gives a final answer of $$ 3\cdot 0 + 28\cdot 1 + 285\cdot 2 + 17\cdot 3 + 1= 650 $$ which is a lot closer to the true answer (48 away rather than 131 away).

3
On

For any (large) $N$ we have

$$\log(N!)=\sum_{k=1}^N\log k={1\over\ln10}\sum_{k=1}^N\ln k={1\over\ln10}\sum_{k=1}^N(\ln(k/N)+\ln N)={N\over\ln 10}\left(\ln N+{1\over N}\sum_{k=1}^N\ln(k/N)\right)\approx{N\over\ln10}\left(\ln N+\int_0^1\ln x\,dx\right)={N\over\ln10}(\ln N-1)$$

For $N=333$, this gives

$$\log(333!)\approx695.35$$

which suggests there are approximately $\lceil695.35\rceil=696$ digits in $333!$.

To be more rigorous about the integral approximation, we have

$$-1=\int_0^1\ln x\,dx\lt{1\over N}\sum_{k=1}^N\ln(k/N)\lt\int_{1/N}^1\ln x\,dx={\ln N+1\over N}-1$$

so

$${N\over\ln10}(\ln N-1)\lt\log(N!)\lt{N\over\ln10}(\ln N-1)+{\ln N+1\over\ln10}$$

which gives the following range for the number of digits:

$$696\le\lceil\log(333!)\rceil\le699$$