I was doing a basic implementation of fibonacci series in python3. Currently I am not thinking about the optimization but the basic output. The case is, the program gets stuck at some point for the value >35 or something.
I really want to know what causing this long calculating time issue?
I have already tried the dynamic programming way, that works fine for larger values too. I have also implemented that in C but no solution. In case of memory storage, it's also not a very big thing to store or process.
def fibonacci_recursive(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fibonacci_recursive(n-1) + fibonacci_recursive(n-2)
print(fibonacci_recursive(45))
Without showing any kind of error, the program get deeper and deeper of recursion.