Given Mth and Nth term of an arithmetic progression. The task is to find the sum of its first p terms.
Input: m = 6, n = 10, mth = 12, nth = 20, p = 5
Input:m = 10, n = 20, mth = 70, nth = 140, p = 4
Approach: Let a is the first term and d is the common difference of the given AP. Therefore
mth term = a + (m-1)d and nth term = a + (n-1)d
From these two equations, find the value of a and d. Now use the formula of sum of p terms of an AP.
Sum of p terms =
( p * ( 2*a + (p-1) * d ) ) / 2;
Below is the implementation of the above approach:
- Find n terms of Fibonacci type series with given first two terms
- Number of quadruples where the first three terms are in AP and last three terms are in GP
- Sum of first n terms of a given series 3, 6, 11, .....
- Sum of the series 5+55+555+.. up to n terms
- Sum of the first N terms of the series 2, 6, 12, 20, 30....
- 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 series (1*2) + (2*3) + (3*4) + ...... upto n terms
- 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 Quadratic Sequence 3 + 7 + 13 + ...
- Find the sum of n terms of the series 1,8,27,64 ....
- Find Pth term of a GP if Mth and Nth terms are given
- Find the sum of first N terms of the series 2×3 + 4×4 + 6×5 + 8×6 + ...
- Sum of series 2/3 - 4/5 + 6/7 - 8/9 + ------- upto n terms
- Sum of the series 0.7, 0.77, 0.777, ... 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 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.