Let $a_n$ be the number of sequences of length $n$ with digits in $\{0, 1, 2, 3\}$ that do not contain consecutive repeated nonzero digits. The last digit of all such sequences can be 0, 1, 2, or 3. I want o find a Recurrence relation describing $a_n$.
My attempt:
If the last digit is $0$, then the remaining $n-1$ digits can be any sequence satisfying the original condition and therefore can be chosen in $a_{n-1}$ ways. However, if the last digit is $1$, $2$, or $3$, then the $n-1$ remaining digits must have the additional condition of not ending with the last digit.
Let $b^a_n$ denote the number of strings that, in addition to the original condition, end with an $a$ with $a \in {1, 2, 3}$. It's clear that $b^1_n = b^2_n = b^3_n$, so we might just show it as $b_n$. In total, we have $a_n = a_{n-1} + 3b_{n-1}$. Then we have to express $b_n$ in terms of $a_n$, but I don't know how to proceed.
You have $b_n$ as the number of such sequences ending in a nonzero digit. Let $c_n$ be the number of such sequences ending in $0$. Now $a_n=b_n+c_n$ and you have already determined that $c_n=a_{n-1}$
$a_n=b_n+c_n\implies b_n=a_n-c_n$
$b_n=3c_{n-1}+2b_{n-1}$
$b_n=3a_{n-2}+2(a_{n-1}-c_{n-1})$
$b_n=3a_{n-2}+2(a_{n-1}-a_{n-2})$
$b_n=2a_{n-1}+a_{n-2}$
$a_n=b_n+c_n=3a_{n-1}+a_{n-2}$