import math def tn_gp(a,n,r): tn = a * (math.pow(r, n - 1)) return tn