Find if a number lies in this pattern

I have a sequence of numbers below...

$1, 2, 4, 7, 11, 16 ...$

You get this list by starting at $1$ then add $1, 2, 3, 4, 5 ...$

Given a number $n$, how can I determine if it will show up in this pattern of numbers?

-

The $k$th term in your sequence is $1+\frac{k(k-1)}{2}$. [See triangular numbers.] Given your number $n$, you just need to check if it is of this form or not.

-
Just to note (not necessarily for angryavian): the true triangular numbers start at $0$. Thus, this is more of a triangular sequence rather than the triangular numbers. Same idea of course, as mentioned above. – Vincent Aug 19 '14 at 2:57
I have no idea how you got that but it works like a charm – Ogen Aug 19 '14 at 7:49

Put another way, take your number, multiply by $8,$ then subtract $7.$ If the result is a perfect square, the number is in the sequence, otherwise no.

-
Analogous to that, for just $\frac{n^2+n}{2}$ you can multiply by $8$ and add $1$. If that result is a perfect square, it is in the sequence. – Vincent Aug 19 '14 at 3:12
@Vincent, the given sequence is shifted by a constant, it would be $(n^2 +n+2)/2$ – Will Jagy Aug 19 '14 at 3:15
Yes. I was using your same technique but applied it to the triangular numbers. I thought since this question is very closely related to the triangular numbers is was worth mentioning the application of your method to them. – Vincent Aug 19 '14 at 3:22
@Vincent, I see. – Will Jagy Aug 19 '14 at 3:23
@Vincent To describe what you have observed, $$8 \frac{n(n+1)}{2}+1=4n^2+4n+1=(2n+1)^2.$$ – angryavian Aug 19 '14 at 3:53