import sys, time sys.setrecursionlimit(sys.maxint) f = lambda n: n-1 +abs(n-1) and f(n-1)*n or 1 ts = time.time() f(22765) print time.time() - ts