$12 \cdot 58$ Find the smallest positive integer $n$ (where $n>1$) such that the quadratic mean of the first $n$ natural numbers is an integer.
(Note: The quadratic mean of $n$ numbers $a_{1}, a_{2}, \cdots, a_{n}$ is $\left.\sqrt{\frac{a_{1}^{2}+a_{2}^{2}+\cdots+a_{n}^{2}}{n}}.\right)$
(15th United States of America Mathematical Olympiad, 1986)
[Solution] Let $\sqrt{\frac{1^{2}+2^{2}+\cdots+n^{2}}{n}}=m, \quad m \in \mathbb{Z}$, then
$$
\begin{array}{l}
\frac{1^{2}+2^{2}+\cdots+n^{2}}{n}=m^{2}, \\
\frac{(n+1)(2 n+1)}{6}=m^{2}, \\
(n+1)(2 n+1)=6 m^{2} .
\end{array}
$$

Since $6 m^{2}$ is even and $2 n+1$ is odd, $n+1$ must be even, hence $n$ is odd.
Let $n=6 p+3$ or $n=6 p-1$ or $n=6 p+1$.
(1) When $n=6 p+3$, then
$$
\begin{array}{c}
(6 p+4)(12 p+7)=6 m^{2}, \\
72 p^{2}+90 p+28=6 m^{2} .
\end{array}
$$

Since
$$
6172,6190,6 \times 28 \text {, }
$$

there is no solution in this case.
(2) When $n=6 p-1$, then
$$
\begin{array}{c}
6 p(12 p-1)=6 m^{2}, \\
m^{2}=p(12 p-1) .
\end{array}
$$

Since $p$ and $12 p-1$ are coprime, for the equation to hold, both $p$ and $12 p-1$ must be perfect squares.
Let
$$
p=s^{2}, \quad 12 p-1=t^{2} \text { . }
$$

Eliminating $p$ gives
$$
t^{2}=12 s^{2}-1=4\left(3 s^{2}-1\right)+3 .
$$

Since a square number modulo 4 can only be 0 or 1, the above equation cannot hold. Thus, there is no solution in this case.
(3) When $n=6 p+1$, then
$$
\begin{array}{c}
(6 p+2)(12 p+3)=6 m^{2} \\
m^{2}=(3 p+1)(4 p+1)
\end{array}
$$

Since $3 p+1$ and $4 p+1$ are coprime, both $3 p+1$ and $4 p+1$ must be perfect squares.
Let
$$
3 p+1=u^{2}, \quad 4 p+1=v^{2} \text { . }
$$

Eliminating $p$ gives
$$
4 u^{2}-3 v^{2}=1 \text { . }
$$

Clearly, $u=v=1$ is one solution, but in this case
$$
p=0, \quad n=1
$$

which contradicts $n>1$.
From $4 u^{2}-3 v^{2}=1$, we know that $v$ must be odd.
Let $v=2 q+1$, then the equation becomes
$$
u^{2}-3 q(q+1)-1=0 \text { . }
$$

Since $q(q+1)$ is even, $u$ must also be odd.
Let $u=2 j+1$, then the equation becomes
$$
4 j(j+1)=3 q(q+1) \text { . }
$$

Clearly, the left side of the equation is a multiple of 8. To make the right side a multiple of 8 and to minimize $n$, let $q+1=8$.
In this case, $q=7, j=6, j+1=7$.
Thus, $u=2 j+1=13, \quad v=2 q+1=15$,
$$
u^{2}=3 p+1=169, \quad p=56 \text { . }
$$

Therefore,
$$
n=6 p+1=337 \text { . }
$$