Stirling's Approximation

Question

Stirling's Approximation for $\ln n!$ is:

$$\ln n! \approx n \ln n - n.$$

Write a program to output $\ln n!$, its Stirling's approximation and the relative error in the approximation, (exact-approx)/exact, for $n < 100$. Then modify the program to output only the first value of $n$ for which the relative error is less than 1%. Hint: the math module provides ("exposes") a factorial() method.


Solution