Given that represents elements of geometric progression in order.One element is missing in progression, find the missing number. It may be assumed that one term is always missing and the missing term is not first or last of series.

Examples:

Input:

{1,3,27,81}

Output:

9

Input:

{4,16,64,1024}

Output:

256

The nth term of a GP **series** is T_{n} = ar^{n-1}, where a = first term and r = common ratio = ( T_{n}/T_{n-1}) .

GP formula in python:

a*(r^(n-1))

which is ar^{n-1}

A = list(map(int,input("Enter the GP sequence numbers: ").split())) #map returns the object. It passes elements from 2nd arguement to 1st. N=len(A) if A[0]!=1: a=A[0] if A[1]/A[0] == A[2]/A[1]: r=A[1]/A[0] for i in range(1,N+1): X=int(a*(r**(i-1))) #Geometric progression formula a*(r^(n-1)) if X!=A[i-1]: print("The missing number from GP sequence is ",X) break else: print("It is not GP Sequence") else: a=A[1] if A[1]%A[0] == A[2]%A[1]: r=A[1]/A[0] for i in range(2,N+1): X=int(a*(r**(i-1))) if X!=A[i-1]: print("The missing number from GP sequence is ",X) break else: print("It is not GP Sequence")

Exc. on terminal

**More Codes to Fcuk**

- Alphabet pyramid
- Find prime numbers between lower and upper ranges
- Prime Factor
- Find the sum of positive even numbers
- An integer interval [a,b], Find the minimum size of a set S.
- Country A and B, how many years the population of A surpasses B.
- Identify pH level
- Find the Perfect Number
- Find out if a word is a palindrome or not
- Find next Palindrome of N number.
- The writing bot Question. A scientist has created a writing bot. Read and write activity needs to be captured.
- Total Number of Odds in the list
- Partition this string into as many parts as possible.
- Leap year
- LCM of two numbers
- Greatest of three numbers
- Find the Gravitational Force Acting Between Two Objects.
- Find the missing element in geometric progression
- Find the GCD Greatest common divisor
- convert a given float number to integer