I wrote this small snippet to calculate Fibonacci numbers. It works well for numbers up to 996 and from 997 a trace back is being printed. I can't figure out what the problem is. Does it has something to do with maximum_recursion_count?
def fib(n):
if n==0:
return 0
elif n==1:
return 1
else:
return fib(n-1)+n