Matrix Exponentiation: Fast Linear Recurrence
Computing the nth Fibonacci number seems trivial. Loop n times, track two variables, done. But what happens when n equals 10^18?
Read more →Computing the nth Fibonacci number seems trivial. Loop n times, track two variables, done. But what happens when n equals 10^18?
Read more →Computing 3^13 by multiplying 3 thirteen times works fine. Computing 2^1000000007 the same way? Your program will run until the heat death of the universe.
Read more →