General problem-solving pattern:
- Write recurrence relation to generating matrix. Fibonacci Q-matrix is an example: http://mathworld.wolfram.com/FibonacciQ-Matrix.html
- Exponentiation by squaring: https://en.wikipedia.org/wiki/Exponentiation_by_squaring.
Problems:
- Easy:
- Normal:
- https://projecteuler.net/problem=324
- Recurrence relation: https://oeis.org/A028452
- https://projecteuler.net/problem=377
- Write generating matrix (a.k.a. transition matrix) directly.
- https://projecteuler.net/problem=435
- https://projecteuler.net/problem=440
- https://projecteuler.net/problem=458
沒有留言:
張貼留言