Square Triangular Number

DOWNLOAD Mathematica Notebook

A number which is simultaneously square and triangular. Let T_n denote the nth triangular number and S_m the mth square number, then a number which is both triangular and square satisfies the equation T_n=S_m, or

 1/2n(n+1)=m^2.
(1)

Completing the square gives

1/2(n^2+n)=1/2(n+1/2)^2-(1/2)(1/4)
(2)
=m^2
(3)
1/8(2n+1)^2-1/8=m^2
(4)
(2n+1)^2-8m^2=1.
(5)

Therefore, defining

x=2n+1
(6)
y=2m
(7)

gives the Pell equation

 x^2-2y^2=1
(8)

(Conway and Guy 1996). The first few solutions are (x,y)=(3,2), (17, 12), (99, 70), (577, 408), .... These give the solutions (n,m)=(1,1), (8, 6), (49, 35), (288, 204), ... (OEIS A001108 and A001109), corresponding to the triangular square numbers 1, 36, 1225, 41616, 1413721, 48024900, ... (OEIS A001110; Pietenpol 1962). In 1730, Euler showed that there are an infinite number of such solutions (Dickson 2005).

The general formula for a square triangular number ST_n is b^2c^2, where b/c is the nth convergent to the continued fraction of sqrt(2) (Ball and Coxeter 1987, p. 59; Conway and Guy 1996). The first few are

 1/1,3/2,7/5,(17)/(12),(41)/(29),(99)/(70),(239)/(169),...
(9)

(OEIS A001333 and A000129). The numerators and denominators can also be obtained by doubling the previous fraction and adding to the fraction before that.

A general formula for square triangular numbers is

ST_n=[((1+sqrt(2))^(2n)-(1-sqrt(2))^(2n))/(4sqrt(2))]^2
(10)
=1/(32)[(17+12sqrt(2))^n+(17-12sqrt(2))^n-2].
(11)

The square triangular numbers also satisfy the recurrence relation

 ST_n=34ST_(n-1)-ST_(n-2)+2.
(12)

A second-order recurrence for ST_n=u_n^2 is given by

 u_(n+2)=6u_(n+1)-u_n,
(13)

with u_0=0 and u_1=1. A first-order recurrence equation is given by

 u_(n+1)=3u_n+sqrt(8u_n^2+1)
(14)

(M. Carreira, pers. comm., Sept. 29, 2003).

A curious product formula for ST_n is given by

 ST_n=2^(2n-5)product_(k=1)^(2n)[3+cos((kpi)/n)].
(15)

An amazing generating function is

 f(x)=(x(x+1))/((1-x)(1-34x+x^2))=x+36x^2+1225x^3+...
(16)

(Sloane and Plouffe 1995).

Taking the square and triangular numbers together gives the sequence 1, 1, 3, 4, 6, 9, 10, 15, 16, 21, 25, ... (OEIS A005214; Hofstadter 1996, p. 15).

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.