# When is $1^5 + 2^5 + \ldots + n^5$ a square?

When is $1^5 + 2^5 + \ldots + n^5$ a square? I found that this happens sometimes: $n=13$ gives $1001^2$, $n=133$ gives $9712992^2$ and $n=1321$ gives $942162299^2$.

I feel that the identity$$\displaystyle\sum_{i=1}^n i^5 = \tfrac{1}{12}[2n^6+6n^5+5n^4-n^2]$$ will be useful, since it's all square powers except one.. but I see no way to connect that.

-
The question you ask is very similar to the classic cannonball problem. See en.wikipedia.org/wiki/Edouard_Lucas, mathworld.wolfram.com/CannonballProblem.html. –  Alex J Best Oct 19 '12 at 18:19
The cannonball problem is integer points on an elliptic curve. This problem is a Pell equation, a much simpler thing. –  zyx Oct 19 '12 at 19:15
+1 Good question. –  AD. Oct 24 '12 at 14:21

The general solution to $$m^2 = \frac{1}{12}(2n^6+6n^5+5n^4−n^2)$$ is $$m = \frac{n(n+1)}{2} y, \quad n = (x-1)/2$$ where $$x+\sqrt{6} y = (3+\sqrt{6}) (5+2 \sqrt{6})^k$$ for some integer $k$. Here are the first few values $$\begin{array}{|r|l|l|l|l|} \hline k& x & y & n & m\\ \hline 0& 3& 1& 1& 1 \\ 1& 27& 11& 13& 1001\\ 2& 267& 109& 133& 971299 \\ 3& 2643& 1079& 1321& 942162299 \\ 4& 26163& 10681& 13081& 913896491101\\ \hline \end{array}$$

The values of $x$, $y$ obey the recursions $$x_{k+1} =10 x_k - x_{k-1}$$ $$y_{k+1} =10 y_k - y_{k-1}$$ There are more complicated recursions for $n$ and $m$, but I didn't work them out.

As several answers have already done, start by factoring $$m^2 = \frac{1}{12}(2n^6+6n^5+5n^4−n^2) = \frac{1}{3} \left( \frac{n(n+1)}{2} \right)^2 (2n^2+2n-1)$$ So $$2n^2 + 2n -1 = 3 y^2$$ where $y = m \left( \frac{n(n+1)}{2} \right)^{-1}$.

Completing the square: $$(2n+1)^2 - 3 = 6 y^2.$$ So we want to solve $$x^2-6 y^2 = 3$$ with $x$ odd.

This is a Pell like equation. The best way to think about Pell's equations is to think in the ring $\mathbb{Z}[\sqrt{6}]$. For an element $a+b \sqrt{6}$ in this ring, the norm $N(a+b \sqrt{6})$ is $a^2-6 b^2$. Norm is multiplicative, meaning that $N((a_1 + b_1 \sqrt{6}) (a_2 + b_2 \sqrt{6})) = N(a_1+b_1\sqrt{6}) N(a_2 + b_2 \sqrt{6})$. We want to find elements $x+y\sqrt{6}$ with $N(x+y\sqrt{6})=3$.

Notice that $N(5+2 \sqrt{6}) = 1$, so, if $N(x+y \sqrt{6})=3$, then $N((x+y \sqrt{6}) (5+2 \sqrt{6})^k)=3$ for any integer $k$. We will eventually be showing that all solutions to $N(x+y\sqrt{6})=3$ are of the form $x+y \sqrt{6} = \pm (3+\sqrt{6})(5+2 \sqrt{6})^k$.

In general, for $D>0$ any nonsquare, there is always some $(u_0,v_0)$ (the fundamental solution of Pell's equation) so that all solutions to $N(u+v \sqrt{D})=1$ are of the form $u+v \sqrt{D} = \pm (u_0 + v_0 \sqrt{D})^n$. In our setting, $(u_0, v_0) = (2,5)$. For any $K$, there finitely many pairs $(x_1, y_1)$, $(x_2, y_2)$, ..., $(x_r,y_r)$ such that all solutions to $N(x+y \sqrt{D})=K$ are of the form $x+y \sqrt{D} = (x_i+y_i \sqrt{D}) (u_0+v_0 \sqrt{D})^k$ for some $i$ and $k$.

We want to show that, in our case, $r=1$ and we can take $(x_1,y_1) = (3,1)$.

Brute force approach: Let $(x,y)$ be a solution to $N(x+y \sqrt{6}) = 3$ with $x$ and $y>0$. Find a nonnegative integer $k$ such that $$(5+2 \sqrt{6})^k < x+y \sqrt{6} < (5+2 \sqrt{6})^{k+1}.$$ This is always possible, since $\lim_{k \to \infty} (5+2 \sqrt{6})^k=\infty$. Notice that $(5+2 \sqrt{6})^{-1} = 5-2 \sqrt{6}$. So the coefficients of $(x+y \sqrt{6})(5+2 \sqrt{6})^{-k}$ are integers; call them $x_0$ and $y_0$. So $$1 < x_0+y_0 \sqrt{6} < 5+2 \sqrt{6} \ \mbox{and} \ N(x_0+y_0 \sqrt{6})=3$$ Also, we have $$x_0-y_0 \sqrt{6} = 3/(x_0+y_0 \sqrt{6})$$ so $$3/(5+2 \sqrt{6}) < x_0-y_0 \sqrt{6} < 3.$$ Adding these together $$\frac{1}{2} \left( 1+\frac{3}{5+2 \sqrt{6}} \right) < x_0 < \frac{1}{2} \left( (5+2 \sqrt{6})+3 \right)$$ or $$0.6 < x_0 < 5.9.$$ Trying $x_0 = 1$, $2$, $3$, $4$, $5$, we quickly discover the only possibility is $x_0=3$, $y_0=1$. So $x+y \sqrt{6} = (3+\sqrt{6})(5+2 \sqrt{6})^k$.

Slick solution Let $I$ be the ideal generated by $x+y \sqrt{6}$ in the ring $\mathbb{Z}[\sqrt{6}]$. Then $\mathbb{Z}[\sqrt{6}]/I$ has order $3$, so $I$ is a prime ideal containing $(3)$. The prime $3$ ramifies in $\mathbb{Z}[\sqrt{6}]$ so there is only one such prime. Clearly, $(3+\sqrt{6})$ is such a prime, so any other solution to $N(x+y \sqrt{6})=3$ must be such that the ideals $(x+y \sqrt{6})$ and $(3+\sqrt{6})$ are equal. So $x+y \sqrt{6} = (3+\sqrt{6})*\mbox{unit}$, and the units in this ring are $\pm (5+2\sqrt{6})^k$.

Where the recursions come from: Let $u = 5+2 \sqrt{6}$. The minimial polynomial of $u$ is $u^2-10u+1=0$. So $u^{k+1} = 10 u^k -u^{k-1}$, implying that $(5+2 \sqrt{6})u^{k+1} = 10(5+2 \sqrt{6})u^k -(5+2 \sqrt{6})u^{k-1}$ and thus that $(x_{k+1} + y_{k+1} \sqrt{6}) = 10(x_k + y_k \sqrt{6}) - (x_{k-1} + y_{k-1} \sqrt{6})$.

-

If $$a=1+2+3+\cdots+n$$ then $$1^5+2^5+3^5+\cdots+n^5 = \frac{4a^3-a^2}{3},$$ so now the question is: when is that a square?

-
Isn't that an elliptic curve? –  sperners lemma Oct 19 '12 at 18:39
As an elliptic curve it is singular, since $4a^3-a^2$ has a double root at $0$. However, I don't think this is the best approach, because once you find the solutions to $y^2= (4a^3-a^2)/3$, you will still have to figure out which of those solutions have $a$ triangular. –  David Speyer Oct 19 '12 at 18:54
And that is a square precisely when $\frac{4a-1}{3}$ is a square, so you don't really need an elliptic curve. –  Thomas Andrews Oct 19 '12 at 19:35
It narrows down to solving $(2n+1)^2-6y^2 = 3$, I think. –  Thomas Andrews Oct 19 '12 at 19:37
@ThomasAndrews Why not transform your comments into answer? You could derive(+1) a Pell-equation and it can be considered as completely discussed so you answered the original question completely. –  vesszabo Oct 24 '12 at 10:20

This is OEIS A031138, which lists some more and says $a(n) =11\cdot(a(n-1)-a(n-2)) + a(n-3) \\ a(n)=-1/2+((3-\sqrt 6)/4)\cdot(5+2\sqrt 6)^n+((3+\sqrt 6)/4)\cdot(5-2\sqrt 6)^n$

-
Wait, doesn't it say: a(n)=-1/2+((3-sqrt(6))/4)*(5+2sqrt(6))^n+((3+sqrt(6))/4)*(5-2sqrt(6))^n? –  Thomas Andrews Oct 19 '12 at 18:20
@ThomasAndrews: missed it. Now added. Thanks –  Ross Millikan Oct 19 '12 at 18:25
great find. I am curious about the soundness and completeness of that recurrence relation. –  sperners lemma Oct 19 '12 at 18:25

If we factor the power sum identity we find the problem equivalent to $$m^2 = \tfrac{1}{3}\left[\frac{n(n + 1)}{2}\right]^2(2n^2 + 2n - 1)$$ or $$m'^2 = \tfrac{1}{3}( 2n^2 + 2n - 1 )$$ this is an integer hence the $1/3$ implies $n\equiv 1\pmod 3$ so let $n = 1 + 3n'$ to get $$m'^2 = 6n'^2 + 6n' + 1$$ but I don't know what now.

The RHS can be described by the recurrence relation: $a_0 = 1$, $a_{n+1} = a_n + 12 n$. Is there any theory about recurrences with '$n$' in them I might be able to use to tell when it takes on square values?

Completing the square like here gives $3(2n'+1)^2 - 2m'^2 = 1$ almost a pell equation with the condition one value is odd.

-
This is a good thought. Now I would complete the square in reverse to get $m'^2=(3n'+1)^2-3n'^2$ so $m'^2=((3-\sqrt 3)n+1)((3+ \sqrt 3)n'+1)$ This feels like a similar structure to the Pell equation, so those expert in its nuances may have more to say. The fact that OEIS cites a recurrence supports that view, but I am stuck as well. –  Ross Millikan Oct 22 '12 at 4:05
@RossMillikan, thanks but I'm still stuck. I thnk it's progress though. –  sperners lemma Oct 23 '12 at 20:00

$$1^5 + 2^5 + ... + n^5 = \frac{1}{12} n^2 (n+1)^2 (2 n^2+2 n-1)$$ Now we need to solve $$\frac{1}{12} n^2 (n+1)^2 (2 n^2+2 n-1)$$ is a perfect square $$\iff\frac{2 n^2+2 n-1}{12} = k^2$$ [do some thing here] I don't know how to solve more

-