Find the k-th member of the recursive sequence


I have a recursive sequence: $ a_n = 5a_{n – 1} + 2a_{n-2} + 3$ , for $ n > 1$ . And I could return $ k-th$ member in $ O(\log{k})$ of sequence i.e. $ a_k$ .
I know how to get the formula of the $ k-th$ member using the generating function method, but I need to find a more algorithmic solution.
For example, like this one.