I want to calculate nth term of fibonacci when my n is large.
n is probably 10^9.
so my F(n) will be something which i cant store in long long or any other.
i want to get F(n)mod100000007.
I am using this method of matrix exponentiation.
My initial matrix is {1
0} and i am multiplying it with { 1 1
1
0 }
that is i am using Y(n) = M^(n-1) * Y(1)
where Y(x)=[ F(n)
F(n-1) ]
so all i have to do is find M[0][0] of M^(n-1) for finding F(n).
But i get on this range problem.
i know tihs relation (a+b)modc=((a%c)+(b%c))%c
but i am not getting how to apply that or any other technique which may help
me in getting to the correct solution for this topic.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.