I have a (very) simple recursive function:
def factorial(n):
if n == 1:
return 1
return n * factorial(n-1)
The maximum recursion depth is 3000, found by running:
import sys
sys.getrecursionlimit()
But factorial(2986)
is the largest number that successfully runs. What accounts for the difference?