Return to Snippet

Revision: 4610
at January 13, 2008 15:04 by darkphotn


Initial Code
(defun factorial(x)
   (cond ((zerop x) 1)
         ('T (* x (factorial (1- x)))) ))

(factorial 1000)

Initial URL


Initial Description
Large factorials are easy to do in LISP, although a number above (2000!) may crash it.  I designed this because of an online post from a mathematician talking about the number 1000! .  Code like this is difficult to write in C-like languages, but a snap in LISP, as the following code demonstrates.

Initial Title
Large Factorials in LISP

Initial Tags
number

Initial Language
Lisp