The Ackermann benchmark program focuses on function calls.
It is used by compiler vendors as a standard for compiler assessment, and is selected to cover interesting aspects of the compiler and target computer.
The function is defined as:
A(x,y) = A(x-1,A(x,y-1))
A(0,y) = y+1
A(x,0) = A(x-1,1)
Ensure that neither x or y are negative values.
The function looks harmless but it grows faster than any primitive recursive function.
Some samples are listed here:
A(0,5)=6
A(1,5)=7
A(2,5)=13
A(3,5)=253
A(4,2) results in 19809 digits!
Some samples for the number of iterations:
A(0,5)=1
A(1,5)=12
A(2,5)=90
A(3,5)=42438
The implementation on the Joyce ist just a gadget.
The program asks for the values of x and y and displays each line containing