Project Euler #116: Red, green or blue tiles

  • + 0 comments

    It passed 100% using linear recurrence and matrix exponentiation in O(log(n)) Red: f(n) = f(n-1) + f(n-2) + 1 Green: f(n) = f(n-1) + f(n-3) + 1 Blue: f(n) = f(n-1) + f(n-4) + 1

    to reduce the time %(10**+7) must be added inside the matrix exponentiation