Editorial
Need a hint? Checkout the editorial.
View Editorial
Editorial
We are asked to find the least $n$ such that $\frac{1^2 + 2^2 + \cdots + n^2}{n}$ is a perfect square.
Now,
$\frac{1^2 + 2^2 + \cdots + n^2}{n} = \frac{(n+1)(2n+1)}{6} = k^2$
$\implies (n+1)(2n+1) = 6k^2$
$\implies n_0 (2n_0 -1) = 6k^2$
$n_0$ cannot be odd. Thus, let $n_0 = 2n_1$.
$\implies n_1 (4n_1 -1) = 3k^2$
Let, $3| n_1$. Thus, $3n_1 = n_2$.
$\implies, k^2 = n_2 (12n_2 - 1)$
Thus, both $n_2$ and $12n_2 -1$ must be perfect squares [$n_2$ and $12n_2 - 1$ are co-prime with each other]. But, $12n_2 -1 \equiv 3 (\text{mod} 4)$. Contradiction.
Thus, $3 | 4n_1 -1 $ .
$\implies 3n_3 = 4n_1 - 1$
$\implies n_1 = \frac{3n_3 +1}{4}$
$\implies n_1 = \frac{3(n_4 + 1) + 1}{4} = 3\frac{n_3}{4} + 1$
$\implies n_1 = 3m + 1$ [$m = \frac{n_3}{4}$]
Now, putting $m$ in our original equation,
$$(3m + 1)(4m+1) = k^2$$
The rest is left as an exercise for you.