Anagram

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Jan 24 06:27:39 EST 2002


Michael Hudson <mwh at python.net> wrote in news:u1ygghyf3.fsf at python.net:

>> It calls GMP's factorial, and I haven't examined it but I believed the
>> latter just did N multiplications (each a rather fast one).  Skip's
>> measurements suggest there may be something better going on inside
>> GMP's factorial, but I don't have GMP's sources right here and now
>> to double-check...
> 
> http://www.swox.com/gmp/manual/Factorial-Algorithm.html
> 
> says
> 
<explanation of complicated factorial algorithm snipped>

Am I alone in thinking that if calculating factorials really were a 
bottleneck in a program I would simply precalculate the values? (Or if you 
want some really big values compute them on the fly and cache the results.)

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list