<s>[INST] Find the $n$th term of $1, 2, 5, 10, 13, 26, 29, ...$ How would you find the $n$th term of a sequence like this?
$1, 2, 5, 10, 13, 26, 29, ...$
I see the sequence has a group of three terms it repeats: Double first term to get second term, add three to get third term, repeat. 
What about: $2, 3, 6, 7, 14, 15, 30,... $?
Again the sequence has a group of three terms it repeats: Add one to first term to get second term, then double second term to get third term. 
How do you compute the $n$th term of such sequences directly, without iterating through all preceding terms?
 [/INST] A more general approach to solving for the $n$th term of such sequences uses matrix multiplication.  Suppose the even terms are nonzero constant $r\neq 1$ times the preceding odd terms, while the odd terms are constant $d$ plus the preceding even terms.  We have:
$$ \begin{pmatrix} 1 & 0 & d \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}
  \begin{pmatrix} a_{2n} \\ a_{2n-1} \\ 1 \end{pmatrix} =
  \begin{pmatrix} a_{2n+1} \\ a_{2n} \\ 1 \end{pmatrix} $$
$$ \begin{pmatrix} r & 0 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}
  \begin{pmatrix} a_{2n+1} \\ a_{2n} \\ 1 \end{pmatrix} =
  \begin{pmatrix} a_{2n+2} \\ a_{2n+1} \\ 1 \end{pmatrix} $$
Combining these by matrix multiplication gives the double step:
$$ \begin{pmatrix} r & 0 & rd \\ 1 & 0 & d \\ 0 & 0 & 1 \end{pmatrix}
  \begin{pmatrix} a_{2n} \\ a_{2n-1} \\ 1 \end{pmatrix} =
  \begin{pmatrix} a_{2n+2} \\ a_{2n+1} \\ 1 \end{pmatrix} $$
The problem is then reduced to finding a closed form for natural powers of the matrix:
$$ A = \begin{pmatrix} r & 0 & rd \\ 1 & 0 & d \\ 0 & 0 & 1 \end{pmatrix} $$
which can be done by diagonalization, since $A$ has three distinct eigenvalues $0,1,r$.
Represent $A$ with respect to the corresponding basis of eigenvectors:
$$ \left\{ \begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix},
  \begin{pmatrix} -rd \\ - d \\ r-1 \end{pmatrix},
  \begin{pmatrix} r \\ 1 \\ 0 \end{pmatrix} \right\} $$
and the resulting similarity transformation diagonalizes $A$, say $A = S D S^{-1}$ where $D= \operatorname{diag}(0,1,r)$.  Thus, assuming an initial value $a_1$ and $a_2 = ra_1$:
$$ A^n \begin{pmatrix} a_2 \\ a_1 \\ 1 \end{pmatrix} =
 S D^n S^{-1} \begin{pmatrix} ra_1 \\ a_1 \\ 1 \end{pmatrix} =
\begin{pmatrix} a_{2n+2} \\ a_{2n+1} \\ 1 \end{pmatrix} $$
The powers of $D$ are explicitly $D^n = \operatorname{diag}(0,1,r^n)$, so this gives a direct expression for any terms in the sequence starting from $a_1$:
$$ a_{2n+1} = r^n a_1 + \frac{r^n -1}{r-1} d $$
$$ a_{2n+2} = r a_{2n+1} = r^{n+1} a_1 + \frac{r^n -1}{r-1} rd $$
taking advantage of the calculation DanielV carried out in the Comment below.
This matrix multiplication technique can be modified to handle more general mixtures of arithmetic and geometric rules.
</s>