Given $n! = c$, how to find $n$? I'm dealing with a time-complexity problem in which I know the running time of an algorithm:
$$t = 1000 \mathrm{ms} .$$
I also know that the algorithm is upper bounded by $O(n!)$.
I want to know the approximate size of the input $n$ based on this:
$$ f(n) = n! = t $$
$$ f^{-1}(t) = n = ? $$

You can use Stirling' approximation formula:
$$\log n! = n\log n - n + \log (2\pi n)/2 + \mathcal{O}(1/n)$$
So you can take the approximation as
$$\log n! \approx n\log n - n + \log (2\pi n)/2 $$
Now given $n! = c$, you can compute an approximate value for $n$ by doing a simple binary search on the above formula.
If you want a direct formula to compute and approximate value for $n$, Shai Covo has given you a link to a mathoverflow thread.
