Hello, Trin769!

Is there an easier way to work out a number sequence which isn't linear?

If we know that the formula is a *quadratic*, there is a sneaky way,

. . but you may need some background.

We begin with a basic quadratic function: .$\displaystyle f(n) \:=\:\frac{n(n+1)}{2}$

This generates the Triangular Numbers: 1, 3, 6, 10, 15, . . .

And it should be obvious why they are called "triangular." Code:

o
o o o
o o o o o o
o o o o o o o o o o
1 3 6 10

So we have the formula: .$\displaystyle T(n) \:=\:\frac{n(n+1)}{2}$

. . and we will *modify* it to fit the given sequence: 1, 2, 4, 7, 11, 16, 22, . . .

For the first few values, compare our sequence $\displaystyle a(n)$ to the triangular numbers $\displaystyle T(n)$

. . $\displaystyle \begin{array}{c||ccccccc}

n & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline\hline

a(n) & 1 & 2 & 4 & 7 & 11 & 16 & 22 \\

T(n) & 1 & 3 & 6 & 10 & 15 & 21 & 28 \end{array}$

The values of $\displaystyle T(n)$ do not match those of $\displaystyle a(n).$

. . Some adjustments are necessary . . . let's examine them.

. . $\displaystyle \begin{array}{c||ccccccc}

n & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline\hline

a(n) & 1 & 2 & 4 & 7 & 11 & 16 & 22 \\

T(n) & 1 & 3 & 6 & 10 & 15 & 21 & 28 \\ \hline

{\color{red}\text{adj}} & {\color{red}\text{-}0} & {\color{red}\text{-}1} & {\color{red}\text{-}2} & {\color{red}\text{-}3} & {\color{red}\text{-}4 }& {\color{red}\text{-}5} & {\color{red}\text{-}6}

\end{array}$

We see that we must subtract a number one less than $\displaystyle n.$

. . Hence: .$\displaystyle a(n) \;=\;T(n) - (n-1)$

And we have: .$\displaystyle a(n) \;=\;\frac{n(n+1)}{2} - (n-1)$

. . Therefore: .$\displaystyle \boxed{a(n) \;=\;\frac{n^2-n+2}{2}}$