More of this type $T_n^2+T_{n+1}^2+T_{n+2}^2=X^2?$

Given triangular numbers,

$$T_n:= {n(n+1)\over 2} = 1,3,6,10,15,...$$

Let $T_n, T_{n+1}$ and $T_{n+2}$ be three consecutive triangular numbers.

My question is: Are there more of $T_n^2+T_{n+1}^2+T_{n+2}^2$ that only yield a square number? Or this is $$T_3^2+T_4^2+T_5^2=6^2+10^2+15^2=19^2$$ the only one? I can't seem to find anymore.

• There are no more solutions up to $n$ 100 million. – B. Mehta Dec 22 '17 at 2:26
• In fact, there are no more solutions for $X$ below $10^{10000}$. If anyone would like to see the code used to check this, feel free to drop me a message. – B. Mehta Dec 22 '17 at 2:59
• @B.Mehta. I would like to see the code. Thanks. – Claude Leibovici Dec 22 '17 at 5:26
• @ClaudeLeibovici I've posted an explanation and some code. – B. Mehta Dec 22 '17 at 19:48

I've checked this for all $X$ up to $10^{10^5}$, here's how. We are searching for integer solutions to $T_{n-1}^2 + T_n^2 + T_{n+1}^2 = X^2$ (note I've reparametrised, compared to the OP), which expands to $$3 n^4 + 6 n^3 + 15 n^2 + 12 n + 4 =4X^2.$$ Curiously enough, this is an invertible expression, and we can instead say $$n = \frac{1}{6} \left(\sqrt{24 \sqrt{3X^2 + 6} - 63}- 3\right)$$ assuming $n>0$.

For $n$ to be an integer, $\sqrt{24 \sqrt{3X^2 + 6} - 63}$ must be an integer, so $24 \sqrt{3X^2 + 6} - 63$ must be a square. Furthermore, it must be an integer, hence $\sqrt{3X^2 + 6}$ must be an integer. (Note that $3X^2 + 6$ is an integer, so $\sqrt{3X^2 + 6}$ is either an integer or irrational - being $\frac{1}{24}$ of an integer cannot work.) So, it suffices to search for integer solutions $(X,Y)$ to the equation $Y^2 - 3X^2 = 6$ such that $24Y-63$ is a square.

But, these are easy to generate, with some knowledge of Pell equations. I'll switch to talking about $x^2 - 3y^2 = 6$ for now, for consistency with literature. First observe that the equation $a^2 - 3b^2 = 1$ has a solution given by $(a,b) = (2, 1)$, and that this is the positive non-trivial solution with smallest $b$. By Theorem 5.3 (and Example 5.6) in Keith Conrad's first blurb on Pell equations, all solutions to this equation are generated by this one. Consulting Keith Conrad's second blurb on Pell equations, we can see that every other solution is a Pell multiple of this one. Considering the original equation $x^2 - 3y^2 = 6$ now, Theorem 3.3 in the second blurb tells us that every solution of this is given by a Pell multiple of a solution $(x_1, y_1)$ where $|x_1| \leq 22$ and $|y_1| \leq 7$. A quick computer check gives only $(3, 1)$ and $(9, 5)$ as the positive solutions here, and $(9, 5)$ is a Pell multiple of $(3, 1)$.

Hence, all solutions of $x^2 - 3y^2 = 6$ are Pell multiples of $(3, 1)$, where the next Pell multiple of pair $(x, y)$ is given by $(2x + 3y, x + 2y)$, so we can easily generate all the positive integer solutions in Haskell! (using the arithmoi library)

import Math.NumberTheory.Powers.Squares

recurse :: (Integer, Integer) -> (Integer, Integer)
recurse (a, b) = (2*a + 3*b, a + 2*b)

vals :: [(Integer, Integer)]
vals = iterate recurse (3, 1)

works :: (Integer, Integer) -> Bool
works (n, _) = isSquare' (24 * n - 63)

solutions :: Integer -> [(Integer, Integer)]
solutions limit = filter works bounded
where bounded = takeWhile (\(y, x) -> x < limit) vals

vals is a list of the solutions to the Pell equation, generated using the recurrence explained above. A pair $(Y, X) = (x, y)$ works if $24Y - 63$ is a square, checked using the arithmoi package for number theory. Finally, solutions limit checks every possible $(Y, X)$ that satisfies X < limit to see if it works or not.

solutions (10^(10^5)) gives [(3, 1), (33, 19)] and the pair $(3, 1)$ corresponds to the trivial solution $T_{-1}^2 + T_0^2 + T_1^2 = 1$, while $(33, 19)$ corresponds to the solution in the OP. In particular, $24 \times 33 - 63 = 729$, so $n=4$, and $T_3^2 + T_4^2 + T_5^2 = 19$.

My computer checks this in under two minutes, but fails for $10^{10^6}$, seemingly due to memory errors. Hopefully someone can grow this into a full proof using cleverer ideas about Pell equations, or check larger values.

EDIT: Now checked up to $10^{2\times {10^5}}$.

• This is really a nice answer ! Thanks for posting it. Cheers $+ \to +1$ indeed. – Claude Leibovici Dec 23 '17 at 3:20