Starting with S(1) = 1, S(2) = 36, and so on. Proof is fairly
straightforward. Well, it seems curious that a thing can be both a
triangle and a square, doesn't it?
Yes, of course. How can something be square and triangular simultaneously?
Well, I had to look through several books in my library till I discovered a discussion of these numbers in A. H. Beiler's Recreations in the Theory of Numbers. Beiler writes: "Eight triangles increased by unity produce a square," because
(2) 
8·r(r + 1)/2 + 1 = 4r^{2} + 4r + 1 = (2r + 1)^{2}.

(2) proves the converse as well: a square decreased by unity gives eight triangles.
This simple rule explains the recurrence relation (1). However, (1) does not enumerate all such numbers. From (1), we get S(3) = 41616, whereas there is another number, 1225, that is both triangular and square: 1225 = 49·50/2 = 35^{2}.
The question was in fact posted as the problem E1473 (AMM, 1962, p. 168) by J.L. Pietepol and solved by A.V. Sylvester [Mathematical Morsels, p. 145, Mathematical Quickies, #186]. Let T_{n} = n(n + 1)/2 denote the nth triangular number. The solution follows from the observation that if T_{n} is a perfect square, so is T_{4n(n+1)}. Indeed, let n(n + 1)/2 = k^{2}. Then 4n(n + 1) = 8k^{2}. Continue:

T_{4n(n+1)} = T_{8k2} 
= 8k^{2}(8k^{2} + 1)/2 = 4k^{2}(8k^{2} + 1) 
 = 4k^{2}[4n(n + 1) + 1] = 4k^{2}[4n^{2} + 4n + 1] 
 = 4k^{2}(2n + 1)^{2}. 

All such numbers can be found by solving a Pell equation: 8x^{2} + 1 = y^{2} which plays a prominent role in number theory.
Numbers Simultaneously Square and Triangular 
8x^{2} + 1 =  y^{2}  Triangular number  Side of triangle  Side of square 
8·1^{2}+1 =  3^{2}  1  1  1 
8·6^{2}+1 =  17^{2}  36  8  6 
8·35^{2}+1 =  99^{2}  1225  49  35 
8·204^{2}+1 =  577^{2}  41616  288  204 
8·1189^{2}+1 =  3363^{2}  1413721  1681  1189 
8·6930^{2}+1 =  19601^{2}  48024900  9800  6930 
8·40391^{2}+1 =  114243^{2}  1631432881  57121  40391 
All such numbers can be obtained by squaring the members of the sequence generated from the recurrence relation
(3) 
u_{n} = 6u_{n1}  u_{n2}, n > 1, u_{0} = 0, u_{1} = 1,

There is also an explicit formula
(4) 
u_{n} = (((1 + √2)^{2n}  (1  √2)^{2n})/(42))^{2}

which can also be written as [Wells, p. 93]
(4) 
u_{n} = [(17 + 12√2)^{n} + (17  12√2)^{n}  2]/32.

([Wells, p. 93] also mentions that no triangular number may be a cube, or fourth or fifth power.)
Armando Guarnaschelli from Argentina found a very simple recurrence relation that generates all triangular numbers that are also square.
References I came across are listed below.
References
 A. H. Beiler's Recreations in the Theory of Numbers, Dover, 1966
 J. H. Conway, R. K. Guy, The Book of Numbers, Springer, 1996
 R. Honsberger's Mathematical Morsels, MAA, 1978
 G. M. Phillips, Mathematics Is Not a Spectator Sport, Springer, 2005
 C. W. Trigg, Mathematical Quickies, Dover, 1985
 D. Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, 1987
Contact
Front page
Contents
Did you know?
Copyright © 19962018 Alexander Bogomolny
