<s>[INST] Alternative for calculating the nth of quadratic sequence Given the quadratic sequence
$$f(n)=1, 7, 19, 37, \cdots$$
To calculate the $f(n)$ for $n\ge1$. $$f(n)=an^2+bn+c$$
We start with the general quadratic function, then sub in for $n:=1,2$ and $3$
$$f(1)=a+b+c$$
$$f(2)=4a+2b+c$$
$$f(3)=9a+3b+c$$
Now solve the simultaneous equations
$$a+b+c=1\tag1$$
$$4a+2b+c=7\tag2$$
$$9a+3b+c=19\tag3$$
$(2)-(1)$ and $(3)-(2)$
$$3a+b=6\tag4$$
$$5a+b=12\tag5$$
$(5)-(4)$
$$a=3$$
$$b=-3$$
$$c=1$$
$$f(n)=3n^2-3n+1$$
This method is very long. Is there another easy of calculating the $f(n)$?
 [/INST] Another standard way is to calculate a difference scheme and then to work backwards:
$$\begin{matrix} 
0 & & 1 & & 2 & & 3 & & 4 \\
  & & 1 && 7 && 19 && 37 \\
  &&    &6& & 12 && 18 & \\
 &&&& 6 && 6 && \\  
\end{matrix} \Rightarrow
\begin{matrix} 
 & 0 & & 1 & & 2 & & 3 & & 4 \\
\color{blue}{c}= &\color{blue}{1} & & 1 && 7 && 19 && 37 \\
\color{blue}{a+b}= &  &\color{blue}{0}&&6& & 12 && 18 & \\
\color{blue}{2a}= &&& \color{blue}{6}&& 6 && 6 && \\  
\end{matrix}$$
$$\Rightarrow a = 3, \; b= -3, \; c = 1 \Rightarrow f(n) = 3n^2-3n+1$$
</s>