Reference articles on history, science, culture and more
Encyclopedia

Square triangular number

Integer that is both a perfect square and a triangular number

Image credit is listed at the end of this article.

In mathematics, a square triangular number (or triangular square number) is a number which is both a triangular number and a square number, in other words, the sum of all integers from 1 to n has a square root that is an integer. There are infinitely many square triangular numbers; the first few are:

0, 1, 36, 1225, 41616, 1413721, 48024900, 1631432881, 55420693056, 1882672131025 (sequence A001110 in the OEIS)
N
A001110
s2 = N
A001109
t(t+1)/2 = N
A001108
000
111
3668
12253549
41616204288
141372111891681
4802490069309800

01Solution as a Pell equation

Write N_{k} for the kth square triangular number, and write s_{k} and t_{k} for the sides of the corresponding square and triangle, so that

\displaystyle N_{k}=s_{k}^{2}={\frac {t_{k}(t_{k}+1)}{2}}.

Define the triangular root of a triangular number N={\tfrac {n(n+1)}{2}} to be n. In the form of the quadratic equation, n^{2}+n-2N=0. From the quadratic formula,

\displaystyle n={\frac {{\sqrt {8N+1}}-1}{2}}.

Therefore, N is triangular (n is an integer) if and only if 8N+1 is square. Consequently, a square number M^{2} is also triangular if and only if 8M^{2}+1 is square, that is, there are numbers x and y such that x^{2}-8y^{2}=1. This is an instance of the Pell equation x^{2}-ny^{2}=1 with n=8. All Pell equations have the trivial solution x=1,y=0 for any n; this is called the zeroth solution, and indexed as (x_{0},y_{0})=(1,0). If (x_{k},y_{k}) denotes the kth nontrivial solution to any Pell equation for a particular n, it can be shown by the method of descent that the next solution is

\displaystyle {\begin{aligned}x_{k+1}&=2x_{k}x_{1}-x_{k-1},\\y_{k+1}&=2y_{k}x_{1}-y_{k-1}.\end{aligned}}

Hence there are infinitely many solutions to any Pell equation for which there is one non-trivial one, which is true whenever n is not a square. The first non-trivial solution when n=8 is easy to find: it is (3,1). A solution (x_{k},y_{k}) to the Pell equation for n=8 yields a square triangular number and its square and triangular roots as follows:

\displaystyle s_{k}=y_{k},\quad t_{k}={\frac {x_{k}-1}{2}},\quad N_{k}=y_{k}^{2}.

Hence, the first square triangular number, derived from (3,1), is 1, and the next, derived from 6\cdot (3,1)-(1,0)=(17,6), is 36.

The sequences N_{k}, s_{k} and t_{k} are the OEIS sequences OEIS: A001110, OEIS: A001109, and OEIS: A001108 respectively.

02Explicit formula

In 1778 Leonhard Euler determined the explicit formula

\displaystyle N_{k}=\left({\frac {\left(3+2{\sqrt {2}}\right)^{k}-\left(3-2{\sqrt {2}}\right)^{k}}{4{\sqrt {2}}}}\right)^{2}.

Other equivalent formulas (obtained by expanding this formula) that may be convenient include

\displaystyle {\begin{aligned}N_{k}&={\tfrac {1}{32}}\left(\left(1+{\sqrt {2}}\right)^{2k}-\left(1-{\sqrt {2}}\right)^{2k}\right)^{2}\\&={\tfrac {1}{32}}\left(\left(1+{\sqrt {2}}\right)^{4k}-2+\left(1-{\sqrt {2}}\right)^{4k}\right)\\&={\tfrac {1}{32}}\left(\left(17+12{\sqrt {2}}\right)^{k}-2+\left(17-12{\sqrt {2}}\right)^{k}\right).\end{aligned}}

The corresponding explicit formulas for s_{k} and t_{k} are:

\displaystyle {\begin{aligned}s_{k}&={\frac {\left(3+2{\sqrt {2}}\right)^{k}-\left(3-2{\sqrt {2}}\right)^{k}}{4{\sqrt {2}}}},\\t_{k}&={\frac {\left(3+2{\sqrt {2}}\right)^{k}+\left(3-2{\sqrt {2}}\right)^{k}-2}{4}}.\end{aligned}}

03Recurrence relations

The solution to the Pell equation can be expressed as a recurrence relation for the equation's solutions. This can be translated into recurrence equations that directly express the square triangular numbers, as well as the sides of the square and triangle involved. We have

\displaystyle {\begin{aligned}N_{k}&=34N_{k-1}-N_{k-2}+2,&{\text{with }}N_{0}&=0{\text{ and }}N_{1}=1;\\N_{k}&=\left(6{\sqrt {N_{k-1}}}-{\sqrt {N_{k-2}}}\right)^{2},&{\text{with }}N_{0}&=0{\text{ and }}N_{1}=1.\end{aligned}}

We have

\displaystyle {\begin{aligned}s_{k}&=6s_{k-1}-s_{k-2},&{\text{with }}s_{0}&=0{\text{ and }}s_{1}=1;\\t_{k}&=6t_{k-1}-t_{k-2}+2,&{\text{with }}t_{0}&=0{\text{ and }}t_{1}=1.\end{aligned}}

04Other characterizations

All square triangular numbers have the form b^{2}c^{2}, where {\tfrac {b}{c}} is a convergent to the continued fraction expansion of {\sqrt {2}}, the square root of 2.

A. V. Sylwester gave a short proof that there are infinitely many square triangular numbers: If the nth triangular number {\tfrac {n(n+1)}{2}} is square, then so is the larger 4n(n+1)th triangular number, since:

\displaystyle {\frac {{\bigl (}4n(n+1){\bigr )}{\bigl (}4n(n+1)+1{\bigr )}}{2}}=4\,{\frac {n(n+1)}{2}}\,\left(2n+1\right)^{2}.

The left hand side of this equation is in the form of a triangular number, and as the product of three squares, the right hand side is square.

The generating function for the square triangular numbers is:

{\frac {1+z}{(1-z)\left(z^{2}-34z+1\right)}}=1+36z+1225z^{2}+\cdots
Watch videos about Square triangular numberExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article Square triangular number, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Images, from Wikimedia Commons:

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.