Is it possible to find the nth term and finite sum for a recursive sequence with case involved Say:
\begin{gather}
a_1 = 55 \\
\\
a_{n + 1} = \begin{cases}
r_a a_n + C,  & \text{if $n$ mod 12 is 6,7,8} \\[2ex]
r_b a_n+C, & \text{otherwise}
\end{cases}
\end{gather}
where:


*

*$C$ is a constant. 

*$0<r_a<1$

*$0<r_b<1$
It is mathematically possible to find


*

*nth term  

*finite sum


I have looked at geometric sequences, nth term and finite sum (here), and technique of solving (here). But because it has a case involve, I am unable to find a solution using those approaches.
 A: Strategy: iterate the recursion twelve times, which eliminates the cases.  To save on typing, I set $r=r_a, s=r_b$.
Provided $n\equiv 1\pmod{12}$, we have
$$a_{n+12}=r(r(r(r(s(s(s(r(r(r(r(ra_n+C)+C)+C)+C)+C)+C)+C)+C)+C)+C)+C)+C$$
which we may rewrite as
$$a_{n+12}=(s^3r^9)a_n + D$$
where $$D=s^3r^8C+s^3r^7C+s^3r^6C+\cdots + s^0r^1C+C$$
Note that $(s^3r^9)$ is a constant between $0$ and $1$; also, $D$ is a constant.  Now, focusing just on the subsequence $a_1, a_{13}, a_{25},\ldots$, it may be solved using known techniques, since there are no cases involved.  You may find the $n$-th term explicitly, and you may find the partial sums of this subsequence, $\{a_{1+12k}\}$.

Now, consider the subsequence $a_2, a_{14}, a_{26},\ldots$.  We know that for this subsequence, $a_{2+12k}=ra_{1+12k}+C$.  Since we have already found everything about the subsequence $\{a_{1+2k}\}$, we can adapt it to the subsequence $\{a_{2+2k}\}$.
We do this repeatedly, for the subsequences $\{a_{3+3k}\}, \ldots, \{a_{11+3k}\}$.  For some of them we will use $r$ to learn everything from the previous step; for  others we will use $s$.

At the conclusion, we will know the $n$-th term for each of the twelve subsequences, and the partial sums for each of the twelve subsequences.  We combine this to get the partial sums for the original series, by adding the twelve partial sums.  As for the $n$-th term of the original sequence, we first determine what $n$ is modulo $12$, then choose the appropriate partial result to apply.
