# A ‘sum of squares’ problem

Recently I came to know from a friend that the only non-trivial value of $n$ satisfying the Diophantine equation

$1^2+2^2+\dots+n^2=m^2$

is $n=24$. And apparently, although the problem looks fairly simple, especially since we have the formula for the left hand side

$\displaystyle 1^2+2^2+\dots+n^2=\frac{n(n+1)(2n+1)}{6}$

the proof is hard. In fact, I was told that all proofs of this result use advanced machinery. Nevertheless, given the simple nature of the problem I was intrigued to give it a try.

So let us assume that

$n(n+1)(2n+1)=6m^2$.

Noting that $2n(n+1)-n(2n+1)=n$, we have that $n(n+1)$ and $2n+1$ are coprime. Indeed, if $g$ is a common factor, then $g$ has to divide both $n$ and $2n+1$, forcing $g=1$. So we deduce that

$\{n(n+1),2n+1\}=\{a^2,6b^2\}$ or $\{2a^2,3b^2\}$

for some integers $a,b$.

Note that $2n+1\not\in \{2a^2,6b^2\}$ so $2n+1\in\{a^2,3b^2\}$. Hence the possibilities are:

(i) $n(n+1)=2a^2$, $2n+1=3b^2$.

(ii) $n(n+1)=6b^2$, $2n+1=a^2$.

First suppose that $n(n+1)=2a^2$. Then $n(n+1)/2=a^2$ is a square triangular number, so

$n=\displaystyle\frac{H_{2k}-1}{2}$

for some $k$, where $P_0,P_1,\dots$ are the Pell numbers. and $H_0,H_1,\dots$ are the half-companion Pell numbers, and they are given by $(1+\sqrt 2)^k=H_k+P_k\sqrt 2$ for each $k$. So we have to find all $k$ such that

$2n+1=\boxed{H_{2k}=3b^2}$.

On the other hand, if $2n+1=a^2$, then $a=2c-1$ for some integer $c$. Then $n=2c(c-1)$. Hence $n(n+1)=6b^2$ implies

$c(c-1)(2c^2-2c+1)=3b^2$.

Now $\gcd(c(c-1),2c^2-2c+1)=1$, so $\{c(c-1),2c^2-2c+1\}=\{u^2,3v^2\}$ for some integers $u,v$. Clearly $c(c-1)\neq u^2$, so

$c(c-1)=3v^2$ and $2c^2-2c+1=u^2$.

So $\{c,c-1,u\}$ is a near isosceles Pythagorean triple, i.e.

$c=\displaystyle\frac{H_{2k-1}+1}{2}$.

Hence

$\boxed{H_{2k-1}^2-1=12v^2\Leftrightarrow P_{2k-1}^2-1=6v^2\Leftrightarrow P_{2k}P_{2k-2}=6v^2}$.

The two boxed cases are what only remain to check, and they show why this actually is a difficult problem! (Refer to the articles about Fibonacci numbers in the ‘Notes and Articles’ tab above to see how little information we have on divisors of sequences of this kind.) Nevertheless, I’ll leave it here and maybe come back to it another time.