Problems > Sequence f=3a+1b > Editorial

Sequence f=3a+1b — Solution & Editorial

Back to the Problem

Exponentiate the 2×2 companion matrix [[3, 1], [1, 0]] in O(log N).

Complexity: O(log N)