Estimate number of digits of 333!

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+$


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$$