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
- Sum of Fibonacci Numbers
- GCD and Fibonacci Numbers
- Sum of Fibonacci Numbers in a range
- Sum of squares of Fibonacci numbers
- Program for Fibonacci numbers
- Prime numbers and Fibonacci
- The Magic of Fibonacci Numbers
- Alternate Fibonacci Numbers
- C Program for Fibonacci numbers
- Sum of Fibonacci Numbers with alternate negatives
- Interesting facts about Fibonacci numbers
- Large Fibonacci Numbers in Java
- Remove all the fibonacci numbers from the given array
- Sum of numbers in the Kth level of a Fibonacci triangle
- Program to print first n Fibonacci Numbers | Set 1
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.