A triangular number is the sum of the n natural numbers from 1 to n. What is the fastest method to find whether a given positive integer number is a triangular one?
He
Home work ?
Sum of numbers from 1 to N
1 + 2 + 3 + 4 + ... n-1 + n
if you add the first plus last, and then the second plus the second from last, then ...
= (1+n) + (2+n-1) + (3+n-2) + (4+n-3) + ... (n/2 + n/2+1)
= (n=1) + (n+1) + (n+1) + ... (n+1); .... n/2 times
= n(n+1)/2
This should get you started ...