# Find the smallest integer $n>1$ such that $\frac{1}{n}\left(1+2^2+3^2+\ldots+n^2\right)$ is a perfect square

Find the smallest integer $$n>1$$ such that $$\frac{1}{n}\left(1+2^2+3^2+\ldots+n^2\right)$$ is a perfect square.

I used the formula for the sum of squares to get $$(n+1)(2n+1)=6k^2$$, where $$k$$ is an integer, but I don't know what to do from here other than keep trying numbers.

## 1 Answer

We’ll first want to convert this into a Pell equation. This is an equation of the form $$x^2-cy^2=1$$. To do this, we do some algebraic manipulation (which essentially amounts to completing the square):$$2n^2+3n+1=6k^2\Leftrightarrow$$ $$16n^2+24n+8=48k^2\Leftrightarrow$$ $$(4n+3)^2-3(4k)^2=1.$$ Letting $$x=4n+3$$, $$y=4k$$, $$c=3$$, our equation takes exactly the form we needed.

Now, Pell equations have been thoroughly studied, and standard methods exist to enumerate its solutions, in order. We just need to enumerate the solutions of this one until $$n$$ and $$k$$ take integer values. By doing this, the first solution we arrive at is $$(x,y)=(7,4)$$, but the condition $$n>1$$ rejects it. The next solution we arrive at is $$(x,y)=(1351,780)$$, which gives $$(n,k)=(337,195)$$, as our smallest solution.