Stirling’s Approximation

Stirling’s approximation states that for large values of $n$:

$n! \sim \sqrt{2πn} * (n/e)^n$

Taking the logarithm of both sides:

$log(n!) \sim log(\sqrt{2πn}) + log((n/e)^n)$

Using properties of logarithms and the fact that $log(a * b) = log(a) + log(b)$:

$log(n!) \sim (1/2) * log(2πn) + n * log(n) - n$

Now, when you use big-O notation, you can ignore constant factors and lower-order terms. So in the context of big O notation:

Therefore: $log(n!) == O(n*log(n))$

In other words, the logarithm of n factorial is asymptotically bounded by O(n log(n)), which means that as n becomes very large, log(n!) grows at most as fast as n log(n).