TITLE: How many digits are there in 100!?
QUESTION [7 upvotes]: How many digits are there in 100 factorial?
How does one calculate the number of digits?

REPLY [7 votes]: Suppose that $x$ is a positive, $n$-digit integer.  Note that,
$$n-1=\log_{10}(10^{n-1}) \leq \log_{10}(x) < \log_{10}(10^n) = n.$$
Thus, you might compute, the floor of $\log_{10}(100!)$ and add $1$.  But
\begin{align}
\log_{10}(100!) 
 &= \sum_{k=1}^{100} \log_{10}(k) \approx \int_{1}^{100}\log_{10}(t)dt \\
 &= \left.\frac{t\ln(t)-t}{\ln(10)}\right|_1^{100} \approx 157.005
\end{align}
Thus, the answer ought to be 158.

The reason this can be expected to work is that the integral can be approximated via Riemann sums.  In fact,
$$\sum_{i=1}^{n} \log_{10}(i) < \int_1^n \log_{10}(t)dt < \sum_{i=2}^n\log(10,i) = \sum_{i=1}^n\log(10,i),$$
as illustrated for $n=20$ in the following picture:

Thus, 
$$\sum_{i=1}^{n} \log_{10}(i) - \sum_{i=1}^n\log(10,i) < 
 \int_1^n \log_{10}(t)dt - \sum_{i=1}^n\log(10,i) < 0.$$
But, the term on the left is just $\log_{10}(100)=2$. So, the integral is a lower bound for the sum that cannot be more than two off of the actual value.  Accounting for the fact that the integral is nearly mid-way between the sums, the error should less than one, which is why we hit he answer exactly.