Fast algorithms for computing the factorial
Check out this paper (PDF link) by Richard Fateman. The code samples are in Lisp, in but in any event, much of the secret boils down to minimizing the number of bignum (arbitrary precision integer) calculations you have to do. Naturally, if you don’t need/have bignums, it’s trivial; either a lookup table or a simple … Read more