I am stuck at the following exercise:
Show that for $n \rightarrow \infty$ holds
$$\log(n!) = n \log n − n + \mathcal{O}(\log n).$$
I do not see how I should prove this. I know that
$$\log(n!) = \log(n)+\log(n-1)+\cdots+\log(1)$$
, and I see that this is similar to $$n\log(n) = \sum_{i=1}^n \log(n)$$but I do not see how this should help here. Could you give me a hint?