Problems > Last Digit of Fibonacci > Editorial

Last Digit of Fibonacci — Solution & Editorial

Back to the Problem

Fibonacci mod 10 repeats with period 60 (the Pisano period): precompute one period and index with N mod 60.

Complexity: O(1) after a 60-step table