Sunday, December 29, 2019

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 ...




Answer



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 \begin{equation} a_n = a_1 + \frac{n(n+1)}{2} - 1 = 2 - 1 + \frac{n(n+1)}{2} = \frac{n^2 + n + 2}{2} \end{equation} 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).


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...