Calculate how many Digits in a large factorial number

preview_player
Показать описание
Lets calculate an estimate for the number of digits in a factorial number. In this case 100! and 823! .
log_10(X) = [n]+1 number of digits . X! = 1x2x3x4x...x(X-1)x(X).
So equally log_10(X!) = log_10(1x2x3x4x...(X-1)x(X)). By the log property is equal to log_10(1)+log_10(2)+log_10(3)+log_10(4)+.....+log_10(X-1)=log_10(X) = [n]+1 number of digits .
so a Reimann sum occurs which we can turn to an integral. So we integrate log_10(x) from 1 to n with respect to X.

The Integral of Ln(x) is found here

Then allow for an error term of log_10(X)/10 and add to n and convert log_10(X) to Ln(X)/Ln(10) and integrate to get the reciprocal of Ln(10) as a constant multiple and the result of integration by parts is X Ln(X)-X from 1 to 100.2 in the 100! case as 0.2 is the proposed error term . This results in [ 157.4049330926264 ] +1 =158 digits in 100! which is correct .

For 823! we have the error term as 0.291539984 so integration from 1 to 823.291539984 gives a result of [ 2043.233978299833 ]+1 =2044 digits in 823! which is also correct

Unfortunately for 5! we get [ 1.8067391973903 ]+1 =2 which is incorrect , as 5!=120 = 3 digits.

#riemannintegral
#numbertheory
#factorial
#digits
#mathstricks
#mathématiques
#maths_tricks
#approximation
#calculus3

Online calculator to find the number of digits in the Factorial of a number found here.

Stirling's formula gives a good approximation:
n!≈√(2πn)(n\e)^n
log(n!)≈log(√(2πn))+n log(n/e)

That was the common base-ten logarithm.
The number of digits in n! equals the next integer above log(n!).

Links to Python3 , C++ , Java , PHP , Javascript
Рекомендации по теме
Комментарии
Автор

Thanks you sir it's really useful in my aptitude test.

rushhourgaming