Big O notation on the log factorial

$\begingroup$

For the computation of the log factorial, i.e., $\log(n!)$, is the Big(O) run time for this $n\log(n)$? How can this be assumed graphically?

***Update: How does the sum of $\log(n!)$ work then? I.e., the sum of log Factorial?

$\endgroup$ 3

2 Answers

$\begingroup$

Notice that:

$$\log(ab)=\log(a)+\log(b)$$

Thus,

$$\log(n!)=\sum_{k=1}^n\log(k)<\sum_{k=1}^n\log(n)=n\log(n)$$

A lower bound may be done with Riemann sums:

$$\sum_{k=1}^n\log(k)>\int_1^n\log(x)\ dx=n\log(n)-n+1$$

Here's the graphical component:

enter image description here

$\endgroup$ 0 $\begingroup$

$$\log(n!) = \sum_{k=1}^n \log(k)$$ Can you figure it out from here using properties of Big-$O$ notation? You'll find that the answer to your conjecture is a resounding yes; graphically, this is because $n^n$ is a decent estimator of $n! $. Look up Stirling Approximation for more detail

$\endgroup$ 10

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like