A quick and dirty approximation of the number of digits in n! is n lg n, which approximates n! from above, via the inequality
1 * 2 * … * n ≤ n * … * n.
(This approximation should be familiar to many from an algorithmics class.)
For a tighter bound, use n lg n - n/2, or a better approximation of ln 10 in place of 1/2 if you wish. This comes from Stirling's approximation which notes that
For a tighter bound, use n lg n - n/2, or a better approximation of ln 10 in place of 1/2 if you wish. This comes from Stirling's approximation which notes that