So I was trying to make a simple program that would calculate the sum of the harmonic series and then print the results. But then the recursion limit stops it from going on.
Here is the program:
def harm_sum(n):
if n < 2:
return 1
else:
return (1 / n) + (harm_sum(n - 1))
x = 1
while True:
print(x, harm_sum(x))
x += 1
I want the program to keep on running despite the recursion limit is there a way to do that?