Given that the ratio to sum of first m and n terms of an A.P. with first term ‘a’ and commond difference ‘d’ is m^2:n^2. The task is to find the ratio of mth and nth term of this A.P.
Input: m = 3, n = 2 Output: 1.6667 Input: m = 5, n = 3 Output: 1.8
Let the Sum of first m and n terms be denoted by Sm and Sn respectively.
Also, let the mth and nth term be denoted by tm and tn respectively.
Sm = (m * [ 2*a + (m-1)*d ])/2
Sn = (n * [ 2*a + (n-1)*d ])/2
Given: Sm / Sn = m^2 / n^2
Hence, ((m * [ 2*a + (m-1)*d ])/2) / ((n * [ 2*a + (n-1)*d ])/2) = m^2 / n^2
=> (2*a + (m-1)*d) / (2*a + (n-1)*d) = m / n
on cross multiplying and solving, we get
d = 2 * a
Hence, the mth and nth terms can be written as:
mth term = tm = a +(m-1)*d = a + (m-1)*(2*a)
nth term = tn = a +(n-1)*d = a + (n-1)*(2*a)
Hence the ratio will be:
tm / tn = (a + (m-1)*(2*a)) / (a + (n-1)*(2*a))
tm / tn = (2*m – 1) / (2*n – 1)
Below is the required implementation:
- Deriving the expression of Fibonacci Numbers in terms of golden ratio
- Ratio of mth and nth term in an Arithmetic Progression (AP)
- Program to find the common ratio of three numbers
- Find nth Fibonacci number using Golden ratio
- Find if it is possible to get a ratio from given ranges of costs and quantities
- Program to calculate the profit sharing ratio
- Divide an isosceles triangle in two parts with ratio of areas as n:m
- Section formula (Point that divides a line in given ratio)
- Program to find the count of coins of each type from the given ratio
- Find amount to be added to achieve target ratio in a given mixture
- Count the number of rectangles such that ratio of sides lies in the range [a,b]
- Ratio of the distance between the centers of the circles and the point of intersection of two transverse common tangents to the circles
- Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles
- Find speed of man from speed of stream and ratio of time with up and down streams
- Ratio of area of a rectangle with the rectangle inscribed in it
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.