Dec 24, 2012 at 12:05pm
please give me a formula to find for example n! contain how many characters?
example:
n= 10
result = 7
Dec 24, 2012 at 1:21pm
You can find the number of digits without calculating the actual factorial by using Stirling's approximation.
An approximation of n! is
sqrt(2*pi*n) * (n/e)^n
Take the log to base 10 and add 1 to find the number of decimal digits.
0.5*log10(2*pi*n) + n*log10(n/e) + 1