Ackermann function

The Ackermann function \(A(x,y)\) is a recursive function defined by:


 * \(y + 1\) if \(x = 0\),
 * \(A(x - 1,1)\) if \(y = 0\), or
 * \(A(x - 1,A(x,y - 1))\) otherwise.

So, for example,

\[ \begin{array}{cclclcl} A(2,2) &=& A(1,A(2,1))\\ &=& A(1,A(1,A(2,0)))&&\\ &=& A(1,A(1,A(1,1)))\\ &=& A(1,A(1,A(0,A(1,0))))\\ &=& A(1,A(1,A(0,A(0,1))))\\ &=& A(1,A(1,A(0,2)))\\ &=& A(1,A(1,2))\\ &=& A(1,A(0,A(1,1)))\\ &=& A(1,A(0,A(0,A(1,0))))\\ &=& A(1,A(0,A(0,1)))\\ &=& A(1,A(0,2))\\ &=& A(1,3)\\ &=& A(0,A(1,2))\\ &=& A(0,A(0,A(1,1)))\\ &=& A(0,A(0,A(0,A(1,0))))\\ &=& A(0,A(0,A(0,A(0,1))))\\ &=& A(0,A(0,A(0,2)))\\ &=& A(0,A(0,3))\\ &=& A(0,4))\\      &=& 5 \end{array} \]

The Ackermann function is largely unrelated to the Ackermann numbers.

The function \(f(n) = A(n, n)\)'s inverse \(f^{-1}(n)\), denoted \(\alpha(n)\), is called the inverse Ackermann function. Since the Ackermann function grows rapidly for small input values, the inverse Ackermann function grows slowly. It has applications in time complexity theory.