12$\cdot$40 Find all solutions of the equation $a^{2}+b^{2}=n!$ where $a, b, n$ are positive integers, and $a \leqslant b, \quad n<14$.
(19th Canadian Mathematics Competition, 1987)
［Solution］When $n=1$, the equation obviously has no solution.
When $n=2$, $a^{2}+b^{2}=2$, we get the solution
$$
a=1, \quad b=1, \quad n=2 .
$$

When $n \geqslant 3$, since 3 divides $n$!, we have
$$
3 \mid a^{2}+b^{2} \text {. }
$$

Since $a$ and $b$ cannot both be divisible by 3, $a^{2}$ and $b^{2}$ are both of the form $3k+1$, thus $a^{2}+b^{2}$ is of the form $3k+2$, and therefore $a^{2}+b^{2}$ cannot be divisible by 3.

If only one of $a$ and $b$ is divisible by 3, then $a^{2}+b^{2}$ is of the form $3k+1$, and it also cannot be divisible by 3.
Therefore, both $a$ and $b$ must be divisible by 3, thus
$$
9 \mid a^{2}+b^{2} \text {. }
$$

Thus, $n$! must be divisible by 9, which means $n \geqslant 6$.
When $n>6$, since $7 \mid n!$, we have
$$
7 \mid a^{2}+b^{2} \text {. }
$$

Note that if $7 \nmid a$, then $a^{2}$ is of the form $7k+1$, $7k+2$, or $7k+4$. Therefore, if $7 \nmid a$ and $7 \nmid b$, $a^{2}+b^{2}$ must be of the form $7k+1$, $7k+2$, $7k+3$, $7k+4$, $7k+5$, or $7k+6$, and cannot be divisible by 7.
Thus, if $7 \mid a^{2}+b^{2}$ holds, it must be that
$$
7 \mid a \text { and } 7 \mid b \text {. }
$$

Therefore,
$$
49 \mid a^{2}+b^{2} \text {. }
$$

In this case, $49 \mid n!$, which means $n \geqslant 14$, contradicting the problem's conditions.
Therefore, when $7 \leqslant n<14$, the equation has no positive integer solutions.
When $n=6$, $a^{2}+b^{2}=6!=2^{4} \cdot 3^{2} \cdot 5$.

Let $a=3u, b=3v$, then we have
$$
u^{2}+v^{2}=2^{4} \cdot 5 .
$$

It is clear that $u$ and $v$ are both even.
Let $u=2p, v=2q$, then we have
$$
p^{2}+q^{2}=2^{2} \cdot 5 \text {. }
$$

Similarly, $p$ and $q$ are both even.
Let $p=2x, q=2y$, then
$$
x^{2}+y^{2}=5 .
$$

Given $a \leqslant b$, we have $x \leqslant y$, thus
$$
\begin{array}{cc}
x=1, & y=2 . \\
a=12, & b=24 .
\end{array}
$$

Therefore, the equation has only two sets of positive integer solutions
$$
(a, b, n)=(1,1,2) \text { and }(12,24,6) .
$$