- or download this
use strict;
use warnings;
...
return ackermann($i-1, ackermann($i,$j-1));
}
}
- or download this
$ perl pseudo_acker.pl 3 4
Iteration 1: i = 3, j = 4
Iteration 2: i = 3, j = 3
...
Iteration 38: i = 1, j = inf
Iteration 39: i = 1, j = inf
Iteration 40: i = 1, j = inf
- or download this
return 2**$j;
- or download this
sub acker {
my ($m, $n) = @_;
...
return acker( $m-1, 1) if $n == 0;
return acker ($m - 1, acker ($m, $n - 1));
}