# Find all n such that there exists a solution of $a^2 + b^2 = n!$ for positive integers $a, b, n$.

I recently found this problem saying:

Find all $$n$$ such that there exists a solution of $$a^2 + b^2 = n!$$ for positive integers $$a, b, n$$.

I first thought to show $$n!$$ will contain some prime of the form $$4k+3$$ odd number of times after some value $$n_0$$. Then I thought by Bertrand's postulate $$n!$$ (for $$n >3$$ ) contains at least one prime only once. If any of them is of the form $$4k+3$$ we would be done. But I failed to make any more progress.

• Well, it should be easy enough to determine the answer, if you can't prove it. As to a possible proof... There are versions of Bertrand's postulate for arithmetic progressions, see, e.g., this question
– lulu
Apr 15 '20 at 18:45
• I think n=2 is the only solution,but i still can't prove it.Can you give me some more hint? Apr 16 '20 at 17:20
• $2$ is not the only solution. There is one other small solution (bigger than $2$). I don't know if the variants of Bertrand I mentioned are strong enough to prove the result or not, I did not try.
– lulu
Apr 16 '20 at 17:35
• It is enough to prove that if $p \equiv 3 \bmod 4$ and $p\ge 7$, then there is a prime $q \equiv 3 \bmod 4$ strictly between $p$ and $2p$. I don't know a proof.
– lhf
Jul 6 '20 at 12:18
• A proof is posted here that $n$ must be $\leq6$. Jul 6 '20 at 15:54