Ackermann's function is a recursive function (like factorial) which can't be easily rewritten in a non-recursive way (unlike factorial which is just a loop). It's an expensive function to calculate, and when written in the most obvious way, some calls to the function take so long to complete that there's no point in doing them. This program uses a technique called 'memo functions' to remember previously computed results, allowing it to avoid most of the recursive calls and execute in far less time. This technique can be applied to any function where the same arguments always give the same results (ie the function has no internal state. These are what computer scientists (but maybe not mathematicians) call 'idempotent' functions). Compare the memo function version to the simple version at http://scratch.mit.edu/projects/28287344/
This memo function uses an array to remember the parameter/result pairs, but that only works if the parameters are contiguous or densely packed. To make a memo function of an arbitrary function, you need to use something like an associative array or a dictionary to store the parameter/result combinations. A simple dictionary program is available at http://scratch.mit.edu/projects/30045458/