# How to solve equation with factorial using algebra?

I bring this sample in order to ilustrate

$$x! = 2^x + 8$$

I know the answer is $x=4$ but I dunno how to prove it. I mean, if i put the number 4 by observation, tryal and error, I can get the results, but I dunno how to solve it isolating x like this:

(1) $x (x-1)! = 2^x +8$

(2) $x = \dfrac{2^x+8}{(x-1)!}$

(3) $x = \dfrac{2^x + 2^3}{(x-1)!}$

(4) $x = \dfrac{2\cdot2^{x-1}+2^3}{(x-1)!}$

From that point on I dunno how to procee using algebra

I would not know how to proceed if I come across another equation that its resolutions is not so easy to solve, like that one by trial and error.

• You can use the fact that $x!$ has a greater growth rate than $2^x$ i.e. $x! > 2^x +8$ for sufficiently large x. Then you can show that there are no more solutions other than 4. Apr 7, 2016 at 4:02

Nothing much changes, even if you ask $$x! = 2^y + 8.$$ As soon as $x \geq 6,$ we have $x!$ divisible by $16.$ As soon as $y \geq 4,$ we know $2^y + 8$ is not divisible by $16.$ Since $6! = 720,$ we would need $y \geq 9,$ guaranteed failure.
So $x \leq 5.$
As pointed out by @marty the same reasoning applies to $$x! = 2^y - 8,$$ with solution $x=5, y=7,$ also $x=4, y=5.$
• Nice reasoning. Works well for $x! = a^y\pm b$ by considering the prime factors of $a$ and $b$. Apr 7, 2016 at 4:20
• @martycohen added in your $\pm$ idea Apr 7, 2016 at 4:31