Stirling's Formula

One interesting attempt to generate n! in constant time would be the following:

1) Use Stirling's Approximation to calculate a value for n!

2) Find analytically the number of zeroes in n!

3) Round the approximation to the nearest correct value; that is, if it has 200 zeroes, round to the nearest 10^200

You can save yourself several WA and TLE solutions by simply not trying this method. It's slower than BigInteger Factorial and less precise - it won't actually give correct answers because of rounding errors.

Never use Stirling's Formula. :)