# Solution of an equation involving even integers

If $x$ is any positive even integer $> 1$. I compute:

$$c = x + x!$$

Now assume instead $c$ (even integer) is given, and I want to get back the value $x$.

Is it possible to find a simple expression for $x$ ?

(or, if not, a convergent procedure to find it)

• Is the given integer $c$ chosen such that $x$ is guaranteed to be an integer? Aug 23, 2014 at 4:45
• Yes, $x$ and $c$ must be both even integers ($>1$)
– Pam
Aug 23, 2014 at 11:33
• Actually, I think that if $c$ is an even integer, then $x$ also necessarily is an even integer (am I wrong?).
– Pam
Aug 23, 2014 at 11:50

From a purely algebraic point of view, assuming that the solution you looked for is large, the equation can be approximated by $$c \simeq \Gamma(x+1)$$ At this point, using Cantrell's approximation of the inverse Gamma function (refer to the link given by Robert Israel), we have $$\Gamma^{-1}(x+1) \simeq \frac{1}{2}+\frac{\log \left(\frac{x+1.03653}{\sqrt{2 \pi }}\right)}{W\left(\frac{\log \left(\frac{x+1.03653}{\sqrt{2 \pi }}\right)}{e}\right)}$$ So, we have a good starting point from which Newton iterations can start and will probably solve in a couple of iterations.

Let me consider a few examples :

• for $c=10^2$, the approximation gives $x=4.88941$ while the exact solution of the entire equation is $x=4.86291$
• for $c=10^4$, the approximation gives $x=7.33372$ while the exact solution of the entire equation is $x=7.33590$
• for $c=10^8$, the approximation gives $x=11.3721$ while the exact solution of the entire equation is $x=11.3735$
• for $c=10^{16}$, the approximation gives $x=18.1518$ while the exact solution of the entire equation is $x=18.1526$

The approximate values are slightly overestimated because I neglected the $x$ term in the equation.

For sure, you can use Newton directly; however, I should strongly recommend to solve instead $$f(x)=\log(x+x!)-\log(c)=0$$ since the logarithmic transform makes the function more "linear" or much less stiff if you prefer.

For example, let us take $c=10^{50}$ and let us be very lazy starting Newton at $x_0=1$; the successive iterates are $161.862$, $53.8383$, $41.6877$, $41.2941$, $41.2936$ which is the solution for six significant figures.

Playing a little with your equation I found a rather good approximation $$x=1.69908 \Big(\log(c)\Big)^{0.655991}$$ For the first cases looked at, the estimates of the solution are then $4.62697$, $7.29071$, $11.4880$, $18.1015$ which seem to be quite good.

• Thanks Claude, it looks like a pretty good approximation. Might also go for some Newton-Raphson type iteration, or there would no be guarantee of convergence?
– Pam
Aug 23, 2014 at 12:12
• You are welcome ! For sure, you can use Newton but, in this case, solve $\log(x+x!)=\log(c)$. I shall add to my answer. Aug 23, 2014 at 12:21
• Very interesting indeed. When adding the suggestion, might you also say something on why it's best to use that log() form, and if or when I am guaranteed to converge to the solution (say, for instance, assuming $c$ even integer such that $x$ > 3)
– Pam
Aug 23, 2014 at 12:23
• @Pam. Please remember that I only address the algebraic problem. Aug 23, 2014 at 12:46
• May I confess that I only know a little about algebra and nothing else ? Aug 23, 2014 at 12:52

The $x$ is very small compared to $x!$, so basically you want to invert the Gamma function. See e.g. this MathOverflow question

• Thank you Robert, very interesting observation and reference.
– Pam
Aug 23, 2014 at 12:10