Find smallest positive integer $n$ (not equal to $1$) so that $\frac{1^2+2^2+3^2+...+n^2}n$ is a perfect square.
I tried to use : $1^2+2^2+3^2+...+n^2=\frac{n(n+1)(2n+1)}6$
That gives us $\frac{1^2+2^2+3^2+...+n^2}n=\frac{(n+1)(2n+1)}6$
I tried to brute-force it using python, and I got $n=337$, but I should probably use modular arithmetic (or something else).