Factorial of a large number in python

后端 未结 9 867
灰色年华
灰色年华 2020-12-29 12:32

Here\'s my approach to factorials:

def factorial(n):
    \'\'\'Returns factorial of n\'\'\'
    r = 1
    for i in range(1, n + 1):
        r *= i
    return         


        
9条回答
  •  误落风尘
    2020-12-29 13:10

    You do realize that factorial(100000) is aproximately 2.8242294080×10^456,573
    That's why it's slow, it's huge.

提交回复
热议问题