Solution (source code)

= Solution

The relation $A^3=4A^2-5A+2I$ reduces $A^k$ inductively to a linear combination of $I,A,A^2$.