# Is there a formula for finding the nth number in a sequence with a changing pattern

If a sequence has a pattern where +2 is the pattern at the start, but 1 is added each time, like the sequence below, is there a formula to find the 125th number in this sequence? It would also need to work with patterns similar to this. For example if the pattern started as +4, and 5 was added each time.

2, 4, 7, 11, 16, 22 ...

• you can read arithmetic progression (AP) or arithmetic sequence you get your answer . – Prabhakaran Apr 23 '16 at 2:11
• $\sum_{n=1}^N n = N(N+1)/2$ you already saw that, no ? – reuns Apr 23 '16 at 2:32
• The term "changing pattern" you use is confusing. If a pattern changes all the time, it is no longer a pattern. However what you have here is a perfectly constant patterns, it is just a bit more complicated than the pattern of always adding the same number. – Marc van Leeuwen Apr 23 '16 at 2:52
• Isn't arithmetic progression only when the difference in the numbers in a sequence is constant? Other math site seem to explain it that way, like this one. Thank you so much though! – Christie Apr 23 '16 at 8:02
• @MarcvanLeeuwen Thank you, you're right! Sorry I couldn't think of how to describe it, and without making the title humongous lol – Christie Apr 23 '16 at 8:05

## 3 Answers

Let $a_1 = 2$. From the way you defined the sequence you can see that $a_n - a_{n-1} = n$. We can use this to find \begin{align} a_n &= a_{n-1} + n\\ &= a_{n-2} + (n-1) + n\\ &= a_{n-3} + (n-2) + (n-1) + n\\ &\vdots \\ &= a_1 + 2 + \cdots + (n - 2) + (n-1) + n \end{align} which is just the sum of the natural numbers except 1($1 + 2 + \cdots + n = \frac{n(n+1)}{2}$). So $$a_n = a_1 + \frac{n(n+1)}{2} - 1 = 2 - 1 + \frac{n(n+1)}{2} = \frac{n^2 + n + 2}{2}$$ where $a_1$ is the starting number (in this case 2). This sequence is a quadratic sequence as it exhibits second differences(the difference of the differences is constant).

• Great explanation! Thank you! – Christie Apr 23 '16 at 8:04

When you have a polynomial expressed as a sequence, you can find it by taking differences $$\begin {array} {l l l l l l} 2&4&7&11&16&22\\2&3&4&5&6\\1&1&1&1 \end {array}$$ where the first line is your sequence and subsequent entries are the difference between the one up and to the right and the one above. The fact that the second differences are constant says you have a second power polynomial. To get the leading term, you take the constant in the second line and divide it by $2!$, so your polynomial starts with $\frac 12n^2$. You can subtract that off and get a linear polynomial, which will be constant in the first line down. Another approach is (once you have concluded that it is quadratic) $A(n)=an^2+bn+c$, take the first three terms as data, and solve the equations for $a,b,c$. You can combine these by noting that $a=\frac 12$ and proceeding.

Let a be the first term. c be the added term. Then you add m more each term.

The kth term is a + c +(c+m)+... +(c + (k-2)m).

That is the kth term is $a + (k-1)c + m\sum_{i=0}^{k-2}i= a + (k-1)c +m\frac {(k-1)(k-2)}{2}$