What is the growth rate of the logarithm of the factorial sequence?

1.4k Views Asked by At

I'd like to know the space complexity of storing bit string representations of the numbers in the factorial sequence (as in a memoized factorial function). So each number $f_i=i!$ in $i=0 \cdots n$ takes $\log_2 f_i$ bits, but how fast does that grow with $i$? Even better would be to know the sum of that sequence or (more reasonably) what a good bound is.

3

There are 3 best solutions below

0
On BEST ANSWER

Probably you need Stirling's theorem.

0
On

Note that $n! = \prod_{i=1}^{n} i \leq \prod_{i=1}^{n} n = n^{n}$. So $log(n!) \leq log(n^{n}) = n log(n)$. And so $log(n!) = O(n log(n))$.

0
On

As for asymptotic bounds, note $\log n! \in \Theta(n \log n)$. This is immediate from $n^n \geq n! \geq (n/2)^{n/2}$.