import time
import math

start_time = time.time()
result = reduce(lambda x, y: x * y, range(1, 10001))
end_time = time.time()
print '%f s' % (end_time - start_time )
print result

start_time = time.time()
result = math.factorial(10000)
end_time = time.time()
print '%f s' % (end_time - start_time )
print result
Retrieved from http://www.chobocho.com/wiki/moniwiki/wiki.php?Factorial
last modified 2010-11-06 02:50:19