# Solving equations with factorials? [duplicate]

I looked on the internet but couldn't find anything relevant, so I was hoping you could help because I have no clue where to even start with how to solve this equations: x! = 6

Obviously trial and error here could work, but is there any way to do it for examples where trial and error would take too long? Thanks.

• keep dividing the right hand side by 2, 3, 4, .until you get 1, then stop. – Paul Mar 14 '16 at 16:41

Using the Stirling approximation

$$n!\approx \sqrt{2\pi n}\left(\frac ne\right)^n$$

or in logarithms,

$$\ln(n!)\approx\frac{\ln(2\pi n)}2+n(\ln(n)-1)=\ln(N),$$

which you can solve for $n$ by numerical methods.

A crude starting approximation is

$$\frac{\ln(N)}{\ln(\ln(N))}.$$

For instance, solving for $N=14!$ yields $n=14.0022249374875\cdots$. No so bad.

Unfortunately there is not simple inverse of the factorial (gamma) function. Here are some methods that you can try however none of them are perfect.

1. Start dividing by 2, then 3... until you get 1.

2. Find the inverse of one of the factorial approximations. From there you can plug $x!$ into the inverse and check around the result to find your answer.

3. I believe there is a series expansion of the gamma function around the fix points that could also be reversed and used as above however I would guess that is more work than it is worth.

4. To simplify the guess and check method you can find a lower bound for the gamma function (there are a bunch) and use that to simplify your search.

$f^{-1}(a)$ is the smallest number that does not evenly divide a given that a is of the form $x!$. You can use this with 4 to limit your search range so that it can be done quickly.

The sequence of factorials is strictly increasing, so there is at most one solution.

$3!=6$, so $x=3$ is the only solution.