All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Triangle Numbers (Posted on 2003-08-07)
Triangle numbers are :

1,3,6,10,15,21,28.

Somebody tells you a random positive integer of any size. Is there a quick way to work out if it is a triangle number or not (in other words, without going through all of the triangle numbers untill you get to a number as high or higher as the integer you've been told)?

 See The Solution Submitted by Lewis Rating: 3.0000 (6 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Puzzle Solution: Method I | Comment 8 of 9 |

Let the random positive integer be P.

If P is a triangle number, then by definition P = m(m+1)/2, for some positive integer m.

Now, we observe that:

8*P + 1
= 8{m(m+1)/2} + 1
= 4*m^2 + 4*m + 1
= (2*m + 1)^2

Thus, if (8*P + 1) is a perfect square, we will know for certain that P is a triangular number.

 Posted by K Sengupta on 2008-05-08 14:24:36

 Search: Search body:
Forums (0)