# Solving factorial equation $x!=\left(x-1\right)! + 96$

I'm stuck with a problem that apparently is simple.

I need to find $$x$$ in following equation:

$$x!=\left(x-1\right)! + 96$$

How can I solve it?

After some passage I've found:

$$\left(x-1\right)\left(x-1\right)! = 96$$

But then I don't know how to continue...

• hint: the function $(x-1)\cdot(x-1)!$ is increasing. Try out some values for $x$. – Giulio Jun 19 at 14:48
• $(x-1)!$ is a product of subsequent integers. If we multiply the product by the largest of them, we obtain $96.$ It suffices to check few values of $x.$ – user376343 Jun 19 at 14:52
• By trying out I've found that the solution is 5, but I'd like to know if there's a more efficient way that trial and error... – Jepessen Jun 19 at 14:53

If you factorize $$96=(2^5)(3^1)=(1.2.3.4)\times 4$$ you can notice it is already in the form $$n!\times n$$ for $$n=4$$ and there is no other way to arrange $$2^5\times 3$$ to make a product of consecutive numbers appear.

Therefore using your equation we get $$x-1=n\iff x=5$$

Edit:

• For larger $$n$$ in $$x!=(x-1)!+n$$ but still reasonably low, the factorization is still a quick method, because $$n$$ being divisible by a factorial it will factorize easily (i.e, not a product of big primes).

For instance let $$n=334764638208000=(2^{19})(3^6)(5^3)(7^2)(11)(13)$$

We can start by examinining $$\dfrac{n}{13!}=(2^9)(3)(5)(7)$$

From there, if I try to continue the sequence $$\, 1,2,\cdots,13\$$ it is not difficult to figure out that $$(14\times 15\times 16)\times 16$$ comes next, and the solution is $$x=17$$.

• For very large $$n$$ this can become tedious,but we can switch to asymptotic approximation of the inverse factorial.

See this post for instance Inverse of a factorial

$$n\sim e\exp\left(\operatorname{W}\left(\frac1{e}\log\left(\frac{n!}{\sqrt{2\pi}}\right)\right)\right)-\frac12\tag{1}$$

Notice also that $$(x-1)!\le (x-1)(x-1)!\le x!$$ therefore $$n$$ is squeezed between two consecutive factorial.

E.g. for $$n=96$$ then $$\overbrace{4!}^{24} \le 96\le \overbrace{5!}^{120}$$ and just need to confirm that $$x=5$$ is effectively solution.

For large $$n$$, it suffice then to calculate the above approximation and test just a few cases to find the suitable $$x$$ (provided $$n$$ fits the equation).

E.g. $$(334764638208000)(!^{-1})\approx 16.978$$ and you just need to check which if $$x=17$$ solves the equation, if not check also $$16$$ and $$18$$.

• Its a wonderful answer but don't you think we have more of used hit and trial. This answer can help in questions having small values of x but what about numbers having large values of x. Even the OP asked to avoid trial and error in the comment. – Jitendra Singh Jun 19 at 15:42
• @JitendraSingh What about now ? – zwim Jun 19 at 16:30
• Yes now the answer is perfect not perfect but a brilliant answer that definitely deserved a upvote from me – Jitendra Singh Jun 19 at 16:40
• Thanks for the answer. I didn't think that for solving this type of equation at the end trial and error or approximations were the right way to do it. – Jepessen Jun 20 at 7:21

Write $$(x-1)(x-1)!$$ as $$(x-1)^2(x-2)!$$
There are only two ways to write $$96$$ in this form: $$2^2 \cdot 4!$$ and $$4^2 \cdot 3!$$ (There is also $$1^2 \cdot 96$$ but $$96$$ isn't a factorial).
Inspection shows that $$96=4^2\cdot 3!$$ gives the solution $$x=5$$. Reducing the problem to two possibilities is hardly trial and error.

• Thanks, but inspections and trial and error can be fine for little values of the constant. I don't know if there's a more general way to solve it, for example by solving $x! = (x-1)! + 5901025694562095573881198946226948593732812800000000$ (which solution is 43)... – Jepessen Jun 20 at 7:23

First, we can move all the terms containing $$x$$ to the left side: $$x!-(x-1)!=96$$

Now, we can write them in expanded form(this is sometimes helpful with problems involving multiple factorials): $$(x*(x-1)*(x-2)*(x-3)*...)-((x-1)*(x-2)*(x-3)*(x-4)*...)=96$$

Aha! We can factor out a $$(x-1)*(x-2)*...$$, which is equivalent to a $$(x-1)!$$ We get: $$x(x-1)!-1(x-1)!=96$$

So, $$(x-1)(x-1)!=96$$

From here, we notice two things:

a) $$(x-1)!$$ is bigger than $$(x-1)$$ b) $$(x-1)!$$ has to be less than $$96$$

This greatly limits our possible choices.

From here, we can either prime factorize $$96$$, or notice that $$96$$ is a multiple of $$24$$. How does that help? Well, $$24=4!$$, and $$96=4*24$$. So that means $$96=4*4!$$

Now, we know $$96=(x-1)*(x-1)!$$, so $$(x-1)*(x-1)!=4*4!$$, so $$x-1=4$$, so

$$\boxed{x=5}$$

• Its a wonderful answer but don't you think we have more of used hit and trial. This answer can help in questions having small values of x but what about numbers having large values of x. Even the OP asked to avoid trial and error in the comment. – Jitendra Singh Jun 19 at 15:42
• @JitendraSingh I wanted to choose a different route to go, because Peter Phipps answer already covered prime factorization, so I just assumed it. The method for higher numbers would be to prime factorize whatever the integer is on the left side, and then, if there are integer solutions for $x$, be of the form $x!*x$. And then you just simplify – Daniel Geyfman Jun 20 at 15:10