[docs] Python faster factorial implementation
jason at jason.gd
Sat May 19 18:49:16 CEST 2012
Hello. I'd like you to change python math module factorial implementation.
For numbers like 100 000 my implementation is pretty much faster:
def fact( a, b ):
if b == a: return a
if b-a > 1:
c=(b + a) >> 1;
return (fact(a, c) * fact(c+1, b))
return a * b
If you use:
the duration is: 0:00:04.022968 !!!
Is it possible or it's too much effort for Python developers?
I'm looking forward for your reply ;)
More information about the docs