How would you convert $n^2$ into a recursive function?
Like for example, I can say the recursive function of $2^n$ is $2 \cdot 2^{n-1}$, and it can be applied recursively since it requires the previous value.
How would you convert $n^2$ into a recursive function?
Like for example, I can say the recursive function of $2^n$ is $2 \cdot 2^{n-1}$, and it can be applied recursively since it requires the previous value.
$a_{n+2}=2a_{n+1}-a_n+2$, with $a_0=0,a_1=1$
Here is one more.
Let $a_n = n^2$. Then simple school algebra should convince you that $$a_{n+1} = a_n + 2\sqrt(a_n) + 1$$
with $a_1 = 1$ and $a_0=0$
If you want a homogeneous linear difference equation then $$ a_{n+3}-3a_{n+2}+3a_{n+1}-a_n=0, \text{ with } a_0=0, a_1=1, a_2=4. $$