# Thread: Recursion help.

1. ## Recursion help.

I have a general question about recursion. When you're either evaluating a recursive definition like:

$\displaystyle f(0) = 1, f(1) = 0, f(2) = 2, f(n) = 2f(n-3)$ for $\displaystyle n\geq3$

and trying to find a general formula for $\displaystyle f(n)$

or trying to give a recursive definition for a formula like:

$\displaystyle a_n = n(n+1)$

Is there an easier way to do it then look at the sequence and try to find some pattern between the 2 formulas, because I'm really bad at figuring about patters in sequences and forming formulas from them.

Any help would be greatly appreciated. Thank you.

2. In answering this, here is something I do not usually do: give a detailed answer.
But it may help you to see how we work on problems.
I used a computer algebra system to produce some 15 terms of the example.
$\displaystyle \begin{array}{*{20}c} n &\vline & 0 &\vline & 1 &\vline & 2 &\vline & 3 &\vline & 4 &\vline & 5 &\vline & 6 &\vline & 7 &\vline & 8 \\ \hline {a_n } &\vline & 1 &\vline & 0 &\vline & 2 &\vline & 2 &\vline & 0 &\vline & 4 &\vline & 4 &\vline & 0 &\vline & 8 \\ \end{array}$

From that brief table, we see blocks of three and powers of two.
It then took some time to find a closed form of the sequence.
Here is what I found using the ceiling function:
$\displaystyle a_n = \left\{ {\begin{array}{cl} {0} & {,3\text{ divides }\left( {n - 4} \right)} \\ {2^{\left\lceil {\displaystyle\frac{{n - 1}} {3}} \right\rceil } } & .\text{else} \\ \end{array} } \right.$