wonszrzeczny / project-euler-258-lagged-fibonacci-sequence-70 Goto Github PK
View Code? Open in Web Editor NEWProblem had difficulty of 70%, solved using logarithmic matrix exponentiation, before I knew about Cayley-Hamilton theorem. Run time: long, since the matrices become dense around millionth power, could be done much faster by calculating x^(10^18) modulo the characteristic equation.