Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
See also…. – lhf Jun 29 '12 at 12:07
up vote 5 down vote accepted

The question came up here on MathOverflow.

share|cite|improve this answer
Great! What a coincidence! – Bazinga Jun 29 '12 at 12:28

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

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.