21. Determine the number of pairs of positive integers $n$ and $m$ such that
$$
1!+2!+3!+\cdots+n!=m^{2} \text {. }
$$
21. Answer: 2
First note that if $n \geq 4$, then
$$
\begin{aligned}
1!+2!+3!+\cdots+n! & =1!+2!+3!+4!(\bmod 5) \\
& =1+2+1+4=3(\bmod 5) .
\end{aligned}
$$

Since the square of any integer is congruent to either 1 or 4 modulo 5 , it follows that $1!+2!+3!+\cdots+n!\neq m^{2}$ for any integer $m$ in this case. So we consider $n<4$.
Now we have
$$
1!=1^{2}, 1!+2!=3,1!+2!+3!=3^{2} .
$$

Hence we conclude that there are two pairs of positive integers $(n, m)$, namely, $(1,1)$ and $(3,3)$, such that $1!+2!+3!+\cdots+n!=m^{2}$.