Rahul Kumar Saurabh

A Recursive LISP function to solve Ackermann’s Function.

   Programs in lisp with output


SOFTWARE USED:- LispWorks 6.1.

THEORY:-
ACKERMANN's  FUNCTION
The Ackermann function, named after Wilhelm Ackermann  is one of the simplest and earliest-discovered examples of a total computable function that is not primitive recursive. All primitive recursive functions are total and computable, but the Ackermann function illustrates that not all total computable functions are primitive recursive.
After Ackermann's publication of his function (which had three nonnegative integer arguments), many authors modified it to suit various purposes, so that today "the Ackermann function" may refer to any of numerous variants of the original function. One common version, the two-argument Ackermann–Peter function, is defined as follows for nonnegative integers m and n:-

SOURCE CODE ( IF INCLUDED )
(defun ackermann (m n)
(cond ((= m 0) (+ n 1))
      ((= m 1) (+ n 2))
      ((= m 2) (+ 3 (* n 2)))
      ((= m 3) (+ 5 (* 8 (- (expt 2 n) 1))))
      (t (cond ((= n 0) (ackermann (- m 1) 1))
               (t (ackermann (- m 1) (ackermann m (- n 1))))
         ))
))

 (ackermann 2 3 )
 9

RESULT:-


CONCLUSION:-

We defined a LISP function to compute Ackermann's Function and test it on various values.