Variant of Bocard's Problem

1. Dec 2, 2012

Someone2841

[All numbers as assumed to be integers]

Bocard's problem asks to find the solutions to the Diophantine equation $n!=m^2-1$. The only known $(n,m)$ pairs are $(4,5),(5,11),(7,71)$, and it is conjectured that there are no more. A generalization of this problem would be $n!=m^2-A$. I've been playing around with this formula, and while I do not have a general proof right now, it seems that one could prove there to be for any non-square $A$ a finite number of solutions (usually 0).

As an example, consider the solutions to $n!=m^2-5$. To show it has a finite number of solutions, consider the equation in terms of mod 3. Assuming $n\geq3$, then $n!\bmod3=0$, and if it can be shown that $m^2 \equiv 2 \pmod{3}$ has no solutions, then $n!=m^2-5$ cannot have a solution with $n\geq3$. It is simple enough to show that the solution set to $m^2 \equiv 2 \pmod{3}$ is null. As $3x$, $3x+1$, and $3x+2$ include all integers, showing that $(3x)^2=9x\equiv 0 \pmod{3}$, $(3x+1)^2=9x^2+6x+1 \equiv 1 \pmod{3}$, $(3x+2)^2=9x+12x+4\equiv 1 \pmod{3}$ demonstrates that any $n^2\bmod3$ will be 0 or 1, but never 2. Therefore, $n$ can only equal 1 or 2; since neither provides a solution, the equation at $A=5$ has no solutions.

Making a quick list of $a^2\bmod b$ cycles (I say cycle since the first $a$ terms will repeat ad infinitum over $b$) and determining which numbers mod b do not exist therein gives a method for finding linear equations for which numbers will have finite solutions. For example, $a^2\bmod 3$ will never include 2. Therefore, for all integers $k$, $A=3k+2$ will have a finite solution set. It's easy enough to write a program to loop through the first several $b$'s and it seems that only numbers in the form $n!=m^2-s^2$ cannot be proven finite by this method; this is simply an observed pattern without a general proof.

Does anyone have any thoughts on this (definitely let me know if I've come to incorrect conclusions)? Is there a good way to go about proving that for all non-square $A$'s there is a finite number of solutions?

---
Edit: My program confirms that non-square numbers from $A=$ 2 to 224 have finite solutions with an upper bound $B$ for $n$ at $B\leq13$. This is what leads me to wonder if this extends to infinity.

2. Dec 7, 2012

3. Dec 8, 2012

ramsey2879

Your post is interesting and I thought it warranted comment but had none to offer. Glad to see that it is now getting a few comments.

4. Dec 9, 2012

Someone2841

Thanks for your reply! I was not familiar with quadratic residues before my original post, though I came across them just a few days ago. I think they are definitely key to the problem.

Thanks :)