faster factorial



For GCL, this program is faster than the much longer one used in Maxima
(defined in ASUM.lisp.).

Almost  3X faster computing 20000!  .


(defun k (n m) ;; (k n 1) is n!
  (declare (fixnum n m))
  (if (<= n m) n
    (* (k n (* 2 m))
       (k (- n m)(* 2 m)))))

There are even faster ways, but I'm not sure how to actually use the
GMP arithmetic to best advantage in GCL.

see http://www.cs.berkeley.edu/~fateman/papers/factorial.pdf
for more thoughts.

RJF