Project Euler 237 - Tours on a 4 X N Playing Board

Official link: https://projecteuler.net/problem=237

Thought Process

I brute forced the first few values

This lead me to https://oeis.org/A181688 which gives us the recursive formula T(n) = 2T(n - 1) + 2T(n - 2) - 2T(n - 3) + T(n - 4), n >= 4

Then, I use my matrix exponentiation function to get the answer very quickly!

The way this is done is as follows:

Interactive Code

Input an integer (yourinput)

Code will output T(yourinput) (mod 10^8)