by thearn4 · 12y ago · 0 comments
For example, the Fibonacci sequence, taken modulo 3 repeats every 8 numbers:
1 1 2 3 5 8 13 21 34 55 89
1 1 2 0 2 2 1 0 1 1 2
That makes it easy to answer such questions as "What is fib(3567^368857) mod 3?". Just compute 3567^368857 mod 8, and be careful to do the lookup right.