Square triangular number



In mathematics, a square triangular number (or triangular square number) is a number which is both a triangular number and a square number. There are infinitely many square triangular numbers; the first few are:

Explicit formulas
Write $$N_k$$ for the $$k$$th square triangular number, and write $$s_k$$ and $$t_k$$ for the sides of the corresponding square and triangle, so that

Define the triangular root of a triangular number $$N=\tfrac{n(n+1)}{2}$$ to be $$n$$. From this definition and the quadratic formula,

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 $$k$$th nontrivial solution to any Pell equation for a particular $$n$$, it can be shown by the method of descent that the next solution is

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:

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, , and respectively.

In 1778 Leonhard Euler determined the explicit formula

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

The corresponding explicit formulas for $$s_k$$ and $$t_k$$ are:

Recurrence relations
There are recurrence relations for the square triangular numbers, as well as for the sides of the square and triangle involved. We have

We have

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

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

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 + 1225 z^2 + \cdots$$