Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
up vote 4 down vote accepted

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.

share|cite|improve this answer
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.

share|cite|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.