python处理大数字代码
# check the numeric range of Python with huge factorials
# factorial(69) still checks out accurately! Has 98 digits in it!
# 171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000
# tested with Python24 vegaseat 01aug2005
def getFactorial(n):
"""returns the factorial of n"""
if n == 0:
return 1
else:
k = n * getFactorial(n-1)
return k
for k in range(1, 70):
print "factorial of", k,"=", getFactorial(k)
