Which of the functions among $2^{3^n}$ or $n!$ grows faster?
I know that $n^n$ grows faster than $n!$ and $n!$ grows faster than $c^n$ where $c$ is a constant, but what is it in my case?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityWhich of the functions among $2^{3^n}$ or $n!$ grows faster?
I know that $n^n$ grows faster than $n!$ and $n!$ grows faster than $c^n$ where $c$ is a constant, but what is it in my case?
You can find the result by taking a $\log$. Hence:
$$\log(2^{3^n}) = 3^n$$ $$\log(n!) \leqslant \log(n^n) = n\log n$$
(In the latter equation, we have used the fact that $n! \leqslant n^n$, as you note in the question.)
Of course $3^n$ grows faster than $n \log n$. As $\log$ is an increasing function, we can say $2^{3^{n}}$ grows faster than $n^n$, and also $n!$.
Another way to directly compare the two expressions is to take the ratio of consecutive terms:
$$\frac{2^{3^{n+1}}}{2^{3^n}}=2^{2\cdot 3^n}\gg 3^n\gg n+1=\frac{(n+1)!}{n!}$$
(for positive integers $n$), and clearly also $2^{3^1}=8>1!$, so $2^{3^n}$ indeed grows more rapidly than $n!$.
You noted in your question that $n^n$ grows faster than $n!$, and that’s a great starting point for comparing the growth of $2^{3^n}$ and $n!$. Specifically, let’s ask - of $n^n$ and $2^{3^n}$, which grows faster?
To answer that, let’s try rewriting $n^n$ so that it has the same exponential base as $2^{3^n}$. Since $n = 2^{\log_2 n}$, we have that
$$n^n = (2^{\log_2 n})^n = 2^{n \log_2 n}.$$
Now, is it easier to see how $n^n$ and $2^{3^n}$ relate?
As a note, this approach is similar to taking the base-2 logs of both expressions. I thought it would be good to include this here because it gives a slightly different perspective on how to arrive at the answer given your initial observation.
Induction.
Base case: $n=1$ gives $2^{3^1}=8$ and $1!=1$ which clearly holds.
Hypothesis: suppose that $2^{3^k}>k!$ for some $k\in\Bbb N$.
Consider $n=k+1$. Then $$2^{3^{k+1}}=2^{3^k\cdot3}>(k!)^3=(k+1)!\cdot\frac{k!(k-1)!}{1+\frac1k}>(k+1)!$$ which is true $\forall k>1$ and thus the result follows.