# $n!+1$ being a perfect square

One observes that \begin{equation*} 4!+1 =25=5^{2},~5!+1=121=11^{2} \end{equation*} is a perfect square. Similarly for $n=7$ also we see that $n!+1$ is a perfect square. So one can ask the truth of this question:

• Is $n!+1$ a perfect square for infinitely many $n$? If yes, then how to prove.
-
I remember having this same question while trying to prove that some polynomials were irreducible in an algebra assignment years ago. Namely, $(x-1)(x-2)\cdots(x-n)+1$ is irreducible when $n$ is not $4$. After showing that its reducibility would imply that it is a square, one is led to your question. We didn't know it was an open problem. –  Jonas Meyer Oct 27 '10 at 5:18
–  barto Mar 18 at 13:08

This is Brocard's problem, and it is still open.

http://en.wikipedia.org/wiki/Brocard%27s_problem

-
oh ho! great i didnt know about it –  anonymous Oct 26 '10 at 16:55
Note that the article says that the number of solutions is finite on the assumption that the ABC conjecture is true. There is now a claimed proof of the ABC conjecture. –  Mark Bennet Oct 1 '12 at 12:19
According to Wikipedia's ABC Conjecture entry, the original proof was in error, but as of March 2013, a proposed correction has been posted. –  Blue Jun 23 '13 at 18:32

The sequence of factorials $n!+1$ which are also perfect squares is here in Sloane. It contains three terms, and notes that there are no more terms below $(10^9)!+1$, but as far as I know there's no proof.

-

My intuition would be that there are very few. There are just not many squares and even fewer factorials. OEIS A025494 lists the squares which are a sum of distinct factorials, which is less restrictive than what you ask and says the list is probably finite. In particular, there are no more below 31!

-

I have an idea(it might be wrong). According to Brocard's problem $$x^{2}-1=n!=5!*(5+1)(5+2)...(5+s)$$ here,$(5+1)(5+2)...(5+s)=\mathcal{O}(5^{s}),5!=k$. So, $$x^{2}-1=k *\mathcal{O}(5^{s})$$ Here, $\mathcal{O}$ is Big O notation. For every rational number $x$ , there is a rational $s$( since $k$ is a constant, if $x$ is increased, $s$ has to be increased to balace the equation). It is a "one-to-one" relation, so there exists a "well-defined" function $f(x)$, so $s=f(x)$ $$x^{2}-1=k *\mathcal{O}(5^{f(x)})$$

Claim: Above equation can not have infinite solution, becuase change rate of $\mathcal{O}(5^{f(x)})$is much bigger than $x^{2}-1$ ,

$$\frac{d}{dx}x^{2} <<\frac{d}{dx} \mathcal{O}(5^{f(x)})$$ if $f(x) = {2 \over \log 5}\log x$ then, $5^{f(x)} = \mathrm e^{f(x) \log 5} = \mathrm e^{2 \log x} = x^2$ but, ${2 \over \log 5}\log x$ is only once integer (when, $x=5$), if Brocard's problem has infinte problem then $f(x)$ must have infinite integer values. So, $f(x) \neq {2 \over \log 5}\log x$. [if $f(x) = {2 \over \log 5}\log x$ then, $5^{f(x)} = \mathrm e^{f(x) \log 5} = \mathrm e^{2 \log x} = x^2$ so, $x$ has to be $5^m$ and the equation becomes,$$5^{2m}-1=k *\mathcal{O}(5^{r})=n!$$ ]

So, after certain value of $x$, the equation will not hold.

Remarks: 1.you can use other integer value instead of 5.
2. there are terms(factorial), in the expansion of $(5+1)(5+2)...(5+s)$, with bigger growth than $5^{s}$ which is used for simplicity.

edit 1: It is known,$x=a^2-b^2;y=2ab; z=a^2+b^2$ are solutions to$x^2+y^2=z^2$,for any integer $a,b$ these solutions works.It can written that,$x=f_1(a,b),y=f_2(a,b),z=f_3(a,b)$ Keeping $b$ constant,$x=g_1(a),y=g_2(a),z=g_3(a)$.

So, for each integer $a$, an integer solution of the equation can be found and as $a$ increases $g_1,g_2,g_3$ increases, because when these $g_1,g_2,g_3$ are plotted on 2D, it can be noticed that from one integer point to another bigger integer point,each of these $g_1,g_2,g_3$ moves continuously to another $g_1,g_2,g_3$ as $g_1,g_2,g_3$ are algebraic, rational expression (otherwise not possible to provide integer solution with transcendental function expression). Same idea is used above.

In general, $g_1,g_2,g_3$ might have points where these function are not differentiable but those points are finite, so the argument can be carried on after those points. For example, if $g(a)= \frac{5a}{a-1}$ then $g$ is continuous after $a=1$.

-
It doesn't really matter if one changes faster than the other, since the quicker one must avoid all squares not just the ones where $x=n$. –  Kristoffer Ryhl May 26 at 6:31
Even though $x^2$ increases faster than $2x$ does, that doesn't mean that there arent infinite integer solutions to $2a=b^2$. The problem is the same here, even though $x!+1$ increases faster than $x^2$, that doesn't necessarily mean that $a!+1=b^2$ doesn't have infinite integer solutions. –  Kristoffer Ryhl May 26 at 14:26
if $2a=b^2$ has infinite integer solution then there exists a function $b=f(a)$ where $f(a),a$ are solution of the equation, right? –  Jim May 26 at 14:32
Not in that case, since it would have to be multivalued. Regardless I can see the idea now. I have another question: When you write $(5+1)(5+2)...(5+s)=\mathcal{O}(5^{r})$, what does it mean when you use different variables on each side? Also, $x!$ increases quicker than $a^x$ for any $a$. –  Kristoffer Ryhl May 26 at 14:44
there is a factorial term in that expansion which increases faster than$5^s$, to include that and for convenience $5^r$ is written. actually you can discard $5^r$ and consider that factorial part which has bigger change rate. probably, I should have written $s=f(x)$ –  Jim May 26 at 14:51