I'm implementing a recursive code that sums the following sequence: x + x ^ 2/2 + x ^ 3/3 ... x ^ n / n, for this sum, I thought of a definition, combining two recursive functions, like it goes down, but it is returning very high values, for n > 3.
def potencia(x, n):
if n == 0: return 1
else:
return x * potencia(x, n - 1)
def Soma_Seq (x, n):
if n == 0: return 0
else:
return x + Soma_Seq(potencia(x, n - 1), n - 1) / n