Check for possibility
if ans_pair [ 0 ] == - 1 : NEW_LINE INDENT print ( " Not ▁ possible " ) NEW_LINE return NEW_LINE DEDENT a1 = ans_pair [ 0 ] NEW_LINE a2 = ans_pair [ 1 ] NEW_LINE r = a2 / a1 NEW_LINE print ( " The ▁ resultant ▁ sequence ▁ is " ) NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT ai = a1 * pow ( r , i - 1 ) NEW_LINE print ( int ( ai ) , end = " ▁ " ) NEW_LINE DEDENT