Factorial Limits


#1

I found that the factorial function has an odd limit.
991
Its a very unspecific number and i was wondering if anyone knew why this is the recursive limit.
Also if there is a way to bypass it i would be glad to know.

Also code is working fine I just put it here as a formality.

def factorial(x):
    if x == 1:
        return 1
    else:
        print x
        return x * factorial(x - 1)

print "The factorial is: " + str(factorial(991))

#2

Hi

after some google research, I found that python has a maximum recursion depth. See for example

" The Python interpreter limits the depths of recursion to help you avoid infinite recursions, resulting in stack overflows "

" sys.getrecursionlimit()
Return the current value of the recursion limit, the maximum depth of the Python interpreter stack. This limit prevents infinite recursion from causing an overflow of the C stack and crashing Python. It can be set by setrecursionlimit(). "

I hope that it answers your question
Cheerio