# Solving $n!+m!+k^2=n!m!$ for positive integers $n,m,k$

I have been running in circles with this for a while now.

It seems that the only solution is $(n,m,k)=(2,3,2)$ but I don't know how to prove it.

Things I have noticed: WLOG $n\geq m$ we see that $k^2$ is a multiple of $m!$. I have a feeling that this might be key; maybe there is a restriction on squares and factorials which is only possible for $n=k=2$... I tried manipulating things, the only potentially useful expression I could come up with was:

$$(n!-1)(m!-1)=1+k^2$$

I have tried modular arithmetic on both sides to get some additional conditions but nothing useful came up. Maybe we could make use of $m!n!<(m+n)!$ to bound $k^2?$ (I doubt it though since the RHS blows up too fast).

I don't know if any of this information is useful though.

• Technically, this is not a Diophantine equation, since diophantine equations only allow polynomials, and $n!$ is not a polynomial in $n$. – Thomas Andrews Mar 4 '13 at 18:21
• In your WLOG, you should have $k^2$ is a multiple of $m!$ – Ross Millikan Mar 4 '13 at 18:33
• @RossMillikan Thanks. – Little miss sunshine Mar 4 '13 at 18:44

## 1 Answer

When $n\geq 4$, $n!-1\equiv -1\pmod 4$, so when $n\geq 4$, some prime $p\equiv -1\pmod 4$ divides $n!-1$ and hence divides $k^2+1$. But that can't be true for $p\equiv -1 \pmod 4$.

So we know $m,n<4$. Now just try all the cases.

• I feel stupid for not seeing this. Thank you! :) – Little miss sunshine Mar 4 '13 at 18:43