I want to prove that $n! = O(n^n)$ based on the definition of big-$O$.
I find it pretty easy to show that $n! = O(n^n)$ by simply showing that $n (n-1) < n \cdot n \ldots$ etc. However I can't figure out how to prove this based on the definition of big-$O$. How can I prove this based upon the definition?
We have $\displaystyle \lim_{n \to \infty} \frac{n!}{n^n}=0, $ which shows that $n!=o(n^n)$ and hence $n!=O(n^n)$.
To compute the limit one can make use of Stirling's formula:
$$n!\sim \sqrt{2\pi n} \frac{n^n}{e^n}.$$