Given a number, N. find the sum of first N odd Fibonacci numbers.
Note: The answer can be very large so print the answer modulo 10^9+7.
Input : N = 3 Output : 5 Expanation : 1 + 1 + 3 Input : 6 Output : 44 Explanation : 1 + 1 + 3 + 5 + 13 + 21
Odd Fibonacci series is:
1, 1, 3, 5, 13, 21, 55, 89......
Prefix sum of odd Fibonacci series is:
1, 2, 5, 10, 23, 44, 99, 188.....
The formula for the sum of first N odd Fibonacci numbers is:
a(n) = a(n-1) + 4*a(n-2) – 4*a(n-3) + a(n-4) – a(n-5) for n>5
Below is the implementation of the above approach:
- Find the GCD of N Fibonacci Numbers with given Indices
- Find two Fibonacci numbers whose sum can be represented as N
- Find the numbers present at Kth level of a Fibonacci Binary Tree
- Non Fibonacci Numbers
- Even Fibonacci Numbers Sum
- GCD and Fibonacci Numbers
- Sum of Fibonacci Numbers
- Sum of Fibonacci Numbers in a range
- Generalized Fibonacci Numbers
- C Program for Fibonacci numbers
- Alternate Fibonacci Numbers
- The Magic of Fibonacci Numbers
- Prime numbers and Fibonacci
- Program for Fibonacci numbers
- Sum of squares of Fibonacci numbers
- Sum of all Non-Fibonacci numbers in a range for Q queries
- Large Fibonacci Numbers in Java
- Program to print first n Fibonacci Numbers | Set 1
- Remove all the fibonacci numbers from the given array
- Sum of Fibonacci Numbers with alternate negatives
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.