Modulo Fibonacci numbers
To efficiently find the Fibonacci number, we use matrix multiplication, more details
here.
Knowing that
Fn+m=FmFn+1+Fm−1Fn, write the recurrence relation for matrix product:
• if m=n then F2n=FnFn+1+Fn−1Fn;
• if m=n+1 then F2n+1=Fn+1Fn+1+FnFn.