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)?
(In reply to
by LynetteVivian)
Any time you multiply a number by 2 (or a multiple of two) it will be even by definition, then when you add 1, (since 1/2 isn't an integer) it will be odd.
When you solve 1/2n² + 1/2n - T = 0 using the quadratic formula, you get (√(8T+1)-1)/2 to find what order number the triangle number is. This method doesn't need any testing too. If you know perfect squares it can even be performed mentally! :)
|
Posted by Gamer
on 2003-08-07 18:32:32 |