How can I show that $\sum \limits_{i=1}^n \log(i)$ is $O(n \log n)?$ (Log in base 2).
Asked
Active
Viewed 2,301 times
2 Answers
3
$$\log(1) + \log(2) + \dots + \log(n)$$
is bounded above by
$$\overbrace{\log(n) + \log(n) + \dots + \log(n)}^{n\text{ terms}}.$$

Lynn
- 3,338
0
We can use the Abel summation to get $$\sum_{i\leq n}\log\left(i\right)=n\log\left(n\right)-\int_{1}^{n}\frac{\left\lfloor t\right\rfloor }{t}dt $$ where $\left\lfloor t\right\rfloor $ is the floor function. Then, using the fact that $\left\lfloor t\right\rfloor =t+O\left(1\right) $ we have $$\sum_{i\leq n}\log\left(i\right)=n\log\left(n\right)-n+O\left(\log\left(n\right)\right). $$ then your claim follows.

Marco Cantarini
- 33,062
- 2
- 47
- 93