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 definition of Ackermann function may vary. For example, Harvey Friedman defines it like so:


 * \(2 \times y\) if \(x = 1\),
 * \(A^{y}_y\) otherwise

The Ackermann function is largely unrelated to the Ackermann numbers.

"Ackermann function" often refers to the single-argument function \(A(n) = A(n, n)\). This is also known as the gag function.

The inverse of the single-argument Ackermann function \(\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.