# Number Theory and Square Number Problem [closed]

Find the least positive integer $$n >1$$ such that the arithmetic mean of the first $$n$$ non zero perfect squares is again a perfect square. Please help. Hope it gives me an idea of equations with integer solutions.

• You should show some effort to avoid votes to close. Do you know how to compute the arithmetic mean of the first $n$ non-zero perfect squares? – J. W. Tanner May 31 at 16:39
• Please don't shout in all caps. – joriki May 31 at 16:52
• This is a beautiful problem. The cannonball problem is not equivalent to it because the problem posted takes the arithmetic mean, which the cannonball problem does not. – Favst May 31 at 17:11

The equation is $$m^2=\frac{1}{n}\sum_{k=1}^{n}{k^2}=\frac{1}{n}\cdot \frac{n(n+1)(2n+1)}{6}=\frac{(n+1)(2n+1)}{6}.$$
With some manipulation, this is equivalent to $$(4n+3)^2-48m^2=1,$$ which can be solved by Pell's equation. The fundamental solution for $$D=48$$ in Pell's equation $$x^2-Dy^2=1$$ is $$(x,y)=(7,1),$$ so all solutions are parameterized by $$x_t + y_t \sqrt{48}=(7+\sqrt{48})^t.$$ We want to find the first solution $$t>1$$ for which $$x_t\equiv 3\pmod{4}.$$ While $$t=2$$ does not work, $$t=3$$ yields $$1351+195\sqrt{48}.$$ Since $$1351=337\cdot 4+3,$$ the answer is $$337.$$
We can check that $$\frac{(337+1)(2\cdot 337+1)}{6}=3^2\cdot 5^2\cdot 13^2.$$