About the sequence: $1, 3, 8, 24, 29, 87, 92, ?...$ find $a_n$ This is a classic and curious recurrence sequence used in logic tests. Your rule can be determined as follows:
for $n$ even: $a_n = 3a_{n-1}$
for $n$ odd: $a_n = a_{n-1} + 5$
That is, the ratio alternates with each term.
Will there be a single formula for $a_n$ in terms of $n$?
 A: A bit of a sneaky answer. The subsequence of only odd terms, $1,8,29,92,\ldots$, is listed in the OEIS as sequence A116952, $b_n=3b_{n-1} + 5$ with $b_0=1$ and has the explicit formula $b_n=\frac723^n-\frac52$. So then, the even terms satisfy $c_n=3b_n=3\left(\frac723^n-\frac52\right)$. Simple indicator functions for odd and even numbers outputting $1$ and $0$ can be constructed as $\frac{\pm(-1)^n+1}{2}$ so we have the explicit formula 
$$\begin{align}a_n=\left(\frac{7}{2}3^{\frac{n-1}{2}}-\frac{5}{2}\right)\left(\frac{-\left(-1\right)^{n}+1}{2}\right)+3\left(\frac{7}{2}3^{\frac{n-1-1}{2}}-\frac{5}{2}\right)\left(\frac{\left(-1\right)^{n}+1}{2}\right)
\\
\\
=\frac14\left[{7\cdot3^{{n}/{2}}\left(1+\frac{1}{\sqrt{3}}\right)-20+\left(-1\right)^{n}\left(7\cdot3^{{n}/{2}}\left(1-\frac{1}{\sqrt{3}}\right)-10\right)}\right]
\end{align}
$$
A: For an even value
\begin{eqnarray*}
a_{2n}=3a_{2n-1}=5+3 a_{2n-2}.
\end{eqnarray*}
Iterate this
\begin{eqnarray*}
a_{2n}=5+3\times 5 +3^2 \times 5 + \cdots 3^{n-1} \times 5 +3^n.
\end{eqnarray*}
Sum the geometric series 
\begin{eqnarray*}
a_{2n}=5\frac{3^{n}-1}{3-1}+3^n = \frac{7 \times 3^n -5}{2}.
\end{eqnarray*}
