Nth Even Fibonacci Number.
I recommend you check this website.
The Fibonacci numbers are the numbers in the following integer sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ………
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation
Fn = Fn-1 + Fn-2 with seed values F0 = 0 and F1 = 1.
The even number Fibonacci sequence is : 0, 2, 8, 34, 144, 610, 2584…. We have to find nth number in this sequence.
The formula of even Fibonacci number = ((4*evenFib(n-1)) + evenFib(n-2));
You can more details on geeksforgeeks post.
Even i used the same code in geeksforgeeks i am getting tle for finding nth even fibonacci .
any help is appreciated.
Notice that every 3rd number is even. So you can find the real index and then use matrix expo