// $Id: ackermann.elastic,v 1.0 2002/04/30 10:49:00 dada Exp $
package ackermann;

import basic;
import sys;
import array;

private function Ack( M, N )
{
    if (M == 0) return( N + 1 );
    if (N == 0) return( Ack(M - 1, 1) );
    return( Ack(M - 1, Ack(M, (N - 1))) );
}


private n = 1;
if(array.length(sys.args) > 0) {
    n = basic.int(sys.args[0]);
} else {
    n = 1;
}
basic.print("Ack(3,", n, "): ", Ack(3, n));