While I was working on some graph theory problem I encounter the following recurrence relation $$a_{n+1}=a_{n-1}+6$$ where $a_0=3.$
Note: I have rewritten the recurrence relation as recommended.
While I was working on some graph theory problem I encounter the following recurrence relation $$a_{n+1}=a_{n-1}+6$$ where $a_0=3.$
Note: I have rewritten the recurrence relation as recommended.
You're alternately adding $2$ and $4$ to the last term of your sequence. Thus every two terms you add $6$, which allows you to easily work out a formula for $a_{2n}$ and from that, deduce a formula for $a_{2n+1}$.
$a_1=a_0+4$;
$a_2=a_1+2=a_0+4+2;$
.
$a_4=a_0+4+2+4+2$
$a_5=a_0+4+2+4+2+4$
thus
if $n$ is odd $a_n=a_0+\frac{n+1}{2}4+\frac{n-1}{2}2$
if $n$ is even $a_n=a_0+\frac{n}{2}(2+4)$