please give me a formula to find for example n! contain how many characters?
result = 7
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