From: rusin@washington.math.niu.edu (Dave Rusin) Newsgroups: sci.math Subject: Re: Triangular numbers and squares... Date: 4 Oct 1995 19:29:46 GMT In article <44shem$929@galileo.polito.it> you write: >Hi, >I'm working on a problem, and in that I have encountered another smaller >problem(!). >In simple words, I'm finding for a method to generate all triangular >numbers that are triple of a perfect square. You need: (n^2+n)/2 = 3 m^2 (4n^2+4n)=24m^2 (2n+1)^2-6 (2m)^2 = 1 x^2-6y^2=1 (with x odd, y even) Now look up "Pell's equation" in any number theory book. All positive solutions to x^2-6y^2 = 1 are those with x + y sqrt(6) being a power of 5 + 2 sqrt(6); conversely all these pairs (x,y) are solutions and, fortunately for you, all have x odd and y even. Thus we may compute ( 5 + 2 sqrt(6) )^2 = 49 + 20 sqrt(6), giving n=24, m=10, and so on. You can also recover x, for example, as x = (1/2) ( (x+y sqrt(6)) + (x-ysqrt(6)) ) = (1/2) ( (5+2 sqrt(6))^n + (5 - 2 sqrt(6))^n ), which is the integer nearest to (1/2)( 5 + 2 sqrt(6) )^n, accounting for the roughly exponential growth of the x's. Finally, the solutions satisfy a 2-term linear recurrence y_(n+1) = 10 y_n - y_(n-1) which enable you quickly to find successive terms. There are many other angles to this problem which you may find interesting, including connections with continued fractions expansions. Whatever your larger problem is, you are likely to find some connections to it in treatments of Pell's equation. dave