4
$\begingroup$

How to obtain the number of digits in $n!$ ?

My approach :

I Used Stirling's formula to find out the approximate value of $n!$

Let the approximate value be $S$

Thus, number of digits in $\ = \left \lfloor \log S \right \rfloor$ + 1

where $\left \lfloor . \right \rfloor$ is floor function.

  • 0
    See also http://stackoverflow.com/questions/1113167/can-one-know-how-large-a-factorial-would-be-before-calculating-it.2012-06-29

2 Answers 2

5

The question came up here on MathOverflow.

  • 0
    Great! What a coincidence!2012-06-29
3

Number of digits in $n!=1+$ $\left \lfloor \log(n!) \right \rfloor$. Now $\log(n!)=\log(1)+\log(2)+...+\log(n)$. Therefore, Number of digits in $n!=$ $1+ \left \lfloor \sum_{1}^{n}\log(k) \right \rfloor$.