$\frac{1^2+2^2+\cdots+n^2}{n}$ is a perfect square

This can be solved by using the quadratic formula on $2n^2 + 3n + (1-6p^2)=0$ to convert to the Pell's equation $r^2 - 48p^2 = 1$. Standard techniques can be used to generate infinitely many solutions, though we need to be careful to keep only those with $r \equiv 3\pmod{4}$.

For example, we can arrive at infinitely many solutions by writing $r+p\sqrt{48} = (7+\sqrt{48})^{2k+1}$, beginning from the primitive solution $r=7, p=1$.

Here is a proof that results from that process:

If $(n,p)$ is a positive solution to $(n+1)(2n+1)=6p^2$, then $(97n+168p+72,56n+97p+42)$ is a larger solution, which we can see by computing directly:

$$((97n+168p+72) + 1)(2(97n+168p+72) + 1) - 6(56n+97p+42)^2$$ $$ = (n+1)(2n+1)-6p^2$$

Beginning from the solution $(n,p)=(1,1)$, this generates infinitely many solutions by induction.


From the equation $(2n+1)(2n+2) = 12p^2$, we know that there are two possibilities:

  • $2n+2$ is of the form $4x^2$, $2n+1$ is of the form $3y^2$.
  • $2n+2$ is of the form $12x^2$, $2n+1$ is of the form $y^2$.

This follows from $2n+1, 2n+2$ being relatively prime. Thus, solutions correspond to integer solutions of the equations $4x^2-3y^2 = 1$ and $12x^2-y^2 = 1$. We claim that the former equation has infinitely many solutions. These correspond to the solutions of $a^2-3b^2 = 1$ where $a$ is even.

The theory of Pell equations can be used to show that the solutions of $a^2-3b^2 = 1$ are given by the powers $a+b\sqrt{3} = (2+\sqrt{3})^i$ for $i\ge 0$. Even without this theory in hand, we can check directly that these give solutions: $$ a^2-3b^2 = (a+b\sqrt{3})(a-b\sqrt{3}) = (2+\sqrt{3})^i(2-\sqrt{3})^i = \big[(2+\sqrt{3})(2-\sqrt{3})\big]^i = 1 $$

It only remains to check that infinitely many of these solutions have $a$ as even. An easy inductive argument shows that $a$ is even precisely when $i$ is odd, so there are infinitely many solutions.

The first two nontrivial solutions are $(2+\sqrt{3})^3 = 26+15\sqrt{3}$ and $(2+\sqrt{3})^5 = 362+209\sqrt{3}$. These values of $a$ correspond to $n=337$ and $n=65521$. To check that these are indeed the smallest nontrivial solutions to $(2n+1)(2n+2)=12p^2$, there are two approaches. The first is to apply the theory of Pell equations to note that there are no solutions to $a^2-3b^2=1$ other than those given above, and that there are no solutions at all to $12x^2-y^2=1$. The second method is to check by brute force that no other values less than $65521$ yield solutions.