# Permutation Problem with a Variable

13P5 = 1287(xPx)

I simplify the above to: 13!/8! = 1287(x!)

The expression on the left simplifies to 154,440.

I divide both sides by 1287 to get: 120=x!

At this point I'm stumped.

-
If you simply calculate $n!$ for the first few positive integers $n$, you should find your $x$ pretty quickly. – Brian M. Scott Jul 24 '11 at 1:55

I am not sure that there is really a better solution than to just calculate the first few factorials at this point and see which one gives you $120$... You should find your answer pretty fast.

It is not possible to invert the "factorial" function in general since it is not injective, i.e. $0!=1!=1$

-
There is another way to go about it, though: divide $120$ by $2$, then divide the quotient by $3$, then that quotient by $4$, and so on: either you reach a quotient of $1$ with divisor the desired $x$, or you reach a quotient less than $1$ without ever getting $1$, in which case there’s no solution. – Brian M. Scott Jul 24 '11 at 1:59
right, very good point. – Vhailor Jul 24 '11 at 2:14
Ah, I thought there might be a non-brute force method for solving for x. Thanks! – Nick Jul 24 '11 at 2:56
If you did know that you had an exact factorial, and it was much larger than this, Stirling's approximation might come in handy. – Mark Bennet Jul 24 '11 at 8:49