I am trying to use this code to calculate the Catalan Number in Python, but it just does not work. How can I fix it?
Here is the code I have:
def catalan_rec(n):
if n == 0:
return 1
else:
b = 0
for i in range (n):
b += sum((catalan_rec(i))*(catalan_rec(n-1-i)))
return b