Find the k-th member of the recursive sequence
Something like this?

$$
\begin{bmatrix}
5 &amp; 2 &amp; 3 \\
1 &amp; 0 &amp; 0 \\
0 &amp; 0 &amp; 1 \\
\end{bmatrix}
\cdot
\begin{bmatrix}
a_n     &amp; a_{n-1} &amp; 0 \\
a_{n-1} &amp; a_{n-2} &amp; 0 \\
1 &amp; 1 &amp; 0
\end{bmatrix}
=
\begin{bmatrix}
a_{n+1} &amp; a_n     &amp; 0 \\
a_n     &amp; a_{n-1} &amp; 0 \\
1       &amp; 1       &amp; 0
\end{bmatrix}
$$

Therefore $a_k$ is the first element of the matrix:
$$
\begin{bmatrix}
5 &amp; 2 &amp; 3 \\
1 &amp; 0 &amp; 0 \\
0 &amp; 0 &amp; 1 \\
\end{bmatrix}^{k-2}
\cdot
\begin{bmatrix}
a_2     &amp; a_1 &amp; 0 \\
a_1 &amp; a_0 &amp; 0 \\
1 &amp; 1 &amp; 0
\end{bmatrix}.
$$

This only requires $O(\log k)$ matrix multiplications, each of which can be done using a constant amount of arithmetic operations on scalars.