Hi guys. We all know that matrix exponentiation can be used to find Nth term of a recurrent relation in logN time, this is generally used to find Nth fibonacci in logN time where N can be as large as 1e18(obviously it is modulo something), now fibonacci is represented as f(n-1)+f(n-2),but what is relation isnt linear, it can be for example, f(n-1)+f(n-2)+f(n-1)*f(fn-2). i tried and could'nt find a solution, so any suggestions>
How to solve problems with matrix exponentiation?
Looks like a matrix exponentiation problem,I will skip that.
lmao, thanks for the advice.
Haha Berlekamp-Massey go BRRRRRRRRRRRRRR
never really met one of those problems in a contest though...
Mathematical savvy should help you. For example Solving Non Linear Recurrence Relation. In our case we can rewrite the recurrence as
Or if we denote
we have
If our initial conditions are
(and nonzero) then
where $F_n$ is $$$n$$$-th Fibonacci number ($$$F_2 = F_1 = 1$$$). The case with zero $$$a$$$ or $$$b$$$ is simple.