Problem 3700 · Hard
The same up and down counts as a linear recurrence, raised to the power n minus 2 by matrix exponentiation.
Open the interactive visualisation