0
I am implementing a recursive code that adds 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, as follows below, but it is returning very high values, to 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