Given three integers A, B and N the task is to find N Geometric means between A and B. WE basically need to insert N terms in a Geometric progression. where A and B are first and last terms.
Input : A = 2 B = 32 N = 3 Output : 4 8 16 the geometric progression series as 2, 4, 8, 16 , 32 Input : A = 3 B = 81 N = 2 Output : 9 27
Let A1, G2, G3, G4……Gn be N geometric Means between two given numbers A and B . Then A, G1, G2 ….. Gn, B will be in Geometric Progression .
So B = (N+2)th term of the Geometric progression.
Then Here R is the common ratio
B = A*RN+1
RN+1 = B/A
R = (B/A)1/(N+1)
Now we have the value of R
And also we have the value of the first term A
G1 = AR1 = A * (B/A)1/(N+1)
G2 = AR2 = A * (B/A)2/(N+1)
G3 = AR3 = A * (B/A)3/(N+1)
GN = ARN = A * (B/A)N/(N+1)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Find N Arithmetic Means between A and B
- Find Harmonic mean using Arithmetic mean and Geometric mean
- Removing a number from array to make it Geometric Progression
- Program for sum of geometric series
- Geometric mean (Two Methods)
- Number of terms in Geometric Series with given conditions
- Sum of Arithmetic Geometric Sequence
- Program for N-th term of Geometric Progression series
- Program to print GP (Geometric Progression)
- Minimum number of operations to convert a given sequence into a Geometric Progression
- Geometric Progression
- Integer part of the geometric mean of the divisors of N
- Check whether nodes of Binary Tree form Arithmetic, Geometric or Harmonic Progression
- Sum of N-terms of geometric progression for larger values of N | Set 2 (Using recursion)
- Product of N terms of a given Geometric series
- Sum of elements of a Geometric Progression (GP) in a given range
- Count subarrays of atleast size 3 forming a Geometric Progression (GP)
- Number of GP (Geometric Progression) subsequences of size 3
- Minimum number of operations to convert a given sequence into a Geometric Progression | Set 2
- Find the radii of the circles which are lined in a row, and distance between the centers of first and last circle is given
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.