How to calc $\log1+\log2+\log3+\log4+...+\log N$? [closed]
Andrew Mclaughlin
How to calculate $\log1+\log2+\log3+\log4+...+\log N= log(N!)$? Someone told me that it's equal to $N\log N,$ but I have no idea why.
$\endgroup$ 44 Answers
$\begingroup$$$x-1\le\lfloor x\rfloor\le x$$ so that
$$\log(x-1)\le\log\lfloor x\rfloor\le\log x$$
and
$$\int_0^n\log x\,dx<\sum_{k=1}^n\log k<\int_{1}^{n+1}\log x\,dx.$$
Hence
$$n\log n-n<\log n!<(n+1)\log(n+1)-n.$$
For instance, with $n=100$,
$$360.5170185988\cdots<363.7393755555\cdots<366.1271722009\cdots$$
A better approximation is given by the famous Stirling's formula,
$$n!\approx\sqrt{2\pi n}\left(\frac ne\right)^n,$$or
$$\log n!=n\log n-n+\frac12\log n+\frac12\log2\pi.$$
For $n=100$,
$$363.7385422250\cdots$$
$\endgroup$ $\begingroup$A small $caveat$: "someone" is wrong: try, for example, with $N=2$; then
$$2\log 2=\log 2^2,$$
while
$$\log1+\log 2=\log 2!=\log 2.$$
For more details on the relationship between the 2 logarithms, I refer to the comments under the OP.
$\endgroup$ 5 $\begingroup$This holds true only for large values of N and Asymptotic notation. i.e. $log(N!)=O(NlogN).$
$\endgroup$ 2 $\begingroup$The integral
$$\int_1^{N}\log(x) \; dx= N\log N - N +1$$
is a good approximation.
For $N=100$, the sum equals $361.3197940$ while the above expression gives $361.5170185.$
$\endgroup$ 1