Which function grows faster, exponential or factorial?

橙三吉。 提交于 2019-12-02 16:31:16

n! eventually grows faster than an exponential with a constant base (2^n and e^n), but n^n grows faster than n! since the base grows as n increases.

n! = n * (n-1) * (n-2) * ...

n^n = n * n * n * ...

Every term after the first one in n^n is larger, so n^n will grow faster.

n^n grows larger than n! -- for an excellent explanation, see the answer by @AlexQueue.

For the other cases, read on:

Factorial functions do asymptotically grow larger than exponential functions, but it isn't immediately clear when the difference begins. For example, for n=5 and k=10, the factorial 5!=120 is still smaller than 10^5=10000. To find when factorial functions begin to grow larger, we have to do some quick mathematical analysis.

We use Stirling's formula and basic logarithm manipulation:

log_k(n!) ~ n*log_k(n) - n*log_k(e)

k^n = n!
log_k(k^n) = log_k(n!)
n*log_k(k) = log_k(n!)
n = log_k(n!)

n ~ n*log_k(n) - n*log_k(e)
1 ~ log_k(n) - log_k(e)
log_k(n) - log_k(e) - 1 ~ 0
log_k(n) - log_k(e) - log_k(k) ~ 0
log_k(n/(e*k)) ~ 0

n/(e*k) ~ 1
n ~ e*k

Thus, once n reaches almost 3 times the size of k, factorial functions will begin to grow larger than exponential functions. For most real-world scenarios, we will be using large values of n and small values of k, so in practice, we can assume that factorial functions are strictly larger than exponential functions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!