are all $n!$ ($n>3$) the difference of two squares?

For the small values of n I have been able to check, it seems that for $n>3$, there exist whole numbers $x,y$ s.t. $n! = x^2 - y^2$. For example ..

$4! = 5^2 - 1^2$

$5! = 11^2 - 1^2$

$6! = 27^2 - 3^2$

$7! = 71^2 - 1^2$

$8! = 201^2 - 9^2$

$9! = 603^2 - 27^2$

$10! = 1905^2 - 15^2$

$11! = 6318^2 - 18^2$

$12! = 21888^2 - 288^2$

In most of the cases above, the $x$ value is just the next integer larger than $\sqrt{n!}$, though at $n=12$ and $n=17$ it's the one following that. With the tools at hand I've only been able to check this as far as $n=17$.

I expect there's probably already a name for this, but not knowing that name, googling was coming up dry.


If $n >3$, then $n!$ is divisible by $4$. So $n!=4k=(2)(2k)$ for some integer $k$. Note now that $$4k=(k+1)^2-(k-1)^2.$$ If $n$ is large, there are many representations of $n!$ as a difference of two squares. For let $2a$ and $2b$ be any two even numbers whose product is $n!$. Then $$n!=4ab=(a+b)^2-(a-b)^2.$$

Comment: Let $a$ be an odd integer. Then $a+1$ and $a-1$ are even, and therefore $(a+1)/2$ and $(a-1)/2$ are integers. We have $$a=\left(\frac{a+1}{2}\right)^2-\left(\frac{a-1}{2}\right)^2,$$ so $a$ is a difference of two squares.

If $a$ is divisible by $4$, the argument we gave above shows that $a$ is a difference of two squares.

If $a$ is even but not divisible by $4$, then $a$ is not a difference of two squares. For a difference of two even squares is divisible by $4$, and a difference of two odd squares is divisible by $8$.