Given first two numbers of series, find n terms of series with these two numbers. The given series follows the same concept as Fibonacci series, i.e., n-th term is sum of (n-1)-th and (n-2)-th terms.
Input: first = 5, sec = 8, n = 5 Output: 5, 8, 13, 21, 34 Input: first = 2, sec = 4, n = 5 Output: 2, 4, 6, 10, 16
The approach is similar to finding Fibonacci series where the summation of last two terms form the next term. Find the sum of first two given numbers, second number now will serve as first number to find the next term and the sum produced will serve as second number to find the next term. Sum of these two newly formed first and second term will form the next required term.
Below is the implementation program:
2 4 6 10 16
Similarly, To find Nth number, generate N terms of series in the above manner and print Nth number.
- Sum of nth terms of Modified Fibonacci series made by every pair of two arrays
- Find the sum of first N terms of the series 2×3 + 4×4 + 6×5 + 8×6 + ...
- Find the sum of first N terms of the series 2*3*5, 3*5*7, 4*7*9, ...
- Sum of first n terms of a given series 3, 6, 11, .....
- Print the first N terms of the series 6, 28, 66, 120, 190, 276, ...
- Sum of the first N terms of the series 5,12, 23, 38....
- Sum of the first N terms of the series 2,10, 30, 68,....
- Sum of the first N terms of the series 2, 6, 12, 20, 30....
- Print first N terms of series (0.25, 0.5, 0.75, ...) in fraction representation
- Sum of P terms of an AP if Mth and Nth terms are given
- Find the sum of all the terms in the n-th row of the given series
- Minimum Fibonacci terms with sum equal to K
- Deriving the expression of Fibonacci Numbers in terms of golden ratio
- Sum of Fibonacci numbers at even indexes upto N terms
- Check if a M-th fibonacci number divides N-th fibonacci number
- Check if sum of Fibonacci elements in an Array is a Fibonacci number or not
- Find the sum of the series 1+11+111+1111+..... upto n terms
- Find the sum of series 0.X + 0.XX + 0.XXX +... upto k terms
- Find the sum of n terms of the series 1,8,27,64 ....
- Find sum of the series 1+22+333+4444+...... upto n terms
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.