# Opposite of Factorial? [duplicate]

Possible Duplicate:
Is there a way to solve for an unknown in a factorial?

I was just wondering, what would be the opposite of factorial?

For example, If I had $n! = 120$. How can I then show algebraically that $n = 5$?

-

## marked as duplicate by J. M., Ross Millikan, Rudy the Reindeer, Henry T. Horton, SashaOct 3 '12 at 2:54

You could repeatedly divide your number by increasing integers; and if at any point you divide by $k$ and are left with $k+1$ then you know that the number you started with is $(k+1)!$. – Clive Newstead Oct 2 '12 at 13:03
Are you looking for a solution that works when the result is a non-integer? For example, suppose someone asks you for $n$ such that $n! = 200$. Do you want to say "There is no such $n$," or do you want to say "$n$ would have to be between 5 and 6", or do you want to say "$n\approx 5.297$"? – MJD Oct 2 '12 at 13:05
@MJD If possible, I would like to know both methods. – Jeel Shah Oct 2 '12 at 13:07
Relevant – MJD Oct 2 '12 at 13:08

[Added because of a question in a comment] The generalization of the factorial is the gamma-function: $n! = \Gamma(1+n)$ where we can also insert noninteger values for n: $y = \Gamma(z)$ such that we have a function over the complex numbers $z$ except the poles at the non-positive integers).[/added]
@gekkostate: you can also numerically invert Stirling's approximation that $\ln n! \approx n \ln n -n +\frac 12\ln(2\pi n)$ to get intermediate values – Ross Millikan Oct 2 '12 at 13:39