What is the inverse of a factorial and how would i calculate it.

E.g. 60000 = n!
How would i get n?

1 answer

You first take the log of both sides:

Log(60,000) = Log(n!)

Then you use the asymptotic expansion:

Log(n!) = n Log(n) - n
+ 1/2 Log(2 pi n) + 1/(12 n)
- 1/(360 n^3) + 1/(1260 n^5)- ...

You solve for n using the Newton Raphson method. If we put:

f(n) = Log(n!) then the derivative f'(n) has the expansion:

f'(n) = Log(n)+ 1/(2n)- 1/(12 n^2)
+ 1/(120 n^4) - 1/(252 n^6)+...

If we make some guess for n, then:

n - [f(n) - 60,000]/f'(n)

will be an improved guess which we can improve again using the above formula. A rough starting guess would be
n = Log(60,000) = about 11. The improved value for n will then be 8.34, the next is n = 8.185. Now 8.185! = 60,0031 so this is already pretty accurate!
Similar Questions
  1. def factorial(n):if n==1: else: return n* factorial(n-1) print("the factorial of ", 7, "is", factorial (7)) how could the
    1. answers icon 1 answer
    1. answers icon 1 answer
  2. Which code reflects the recursive case?(1 point) Responses else: return (x * factorial(x - 1)) else: return (x * factorial(x -
    1. answers icon 1 answer
    1. answers icon 1 answer
more similar questions