I'm having trouble organizing a recursive sum formula in Python. I need to calculate:
My code:
def seq1(n):
if n == 1:
return n
return seq1(n-1)+(-1**(n+1)/n)
I get the same error for almost every change:
RecursionError: maximum recursion depth exceeded in comparison
I would like to know how to do the calculation, thank you in advance!