In computability theory, the Ackermann function or Ackermann-Péter function is a simple example of a computable function that is not primitive recursive. It takes two natural numbers as arguments and yields another natural number. Its value grows extremely quickly; even for small inputs, for example (4,3), the values of the Ackermann function become so large that they cannot be feasibly computed, and in fact their decimal expansions require more digits than there are particles in the entire visible universe.
Ackermann originally considered a function A(m, n, p) of three variables, the p-fold iterated exponentiation of m with n, or m → n → p as expressed using the Conway chained arrow notation. When p = 1, this is mn, which is m multiplied by itself n times. When p = 2, it is a tower of exponents with n levels, or m raised n times to the power m also written as nm, the tetration of m with n. We can continue to generalize this indefinitely as p becomes larger.
Ackermann proved that A is a recursive function, a function a computer with unbounded memory can calculate, but it is not a primitive recursive function, a class of functions including almost all familiar functions such as addition and factorial.
In On the Infinite, David Hilbert hypothesized that the Ackermann function was not primitively recursive, but it was Ackermann, a former student and Hilbert’s personal secretary, who actually proved the hypothesis in his paper On Hilbert’s Construction of the Real Numbers. On the Infinite was Hilbert’s most important paper on the foundations of mathematics, serving as the heart of Hilbert's program to secure the foundation of transfinite numbers by basing them on finite methods. The paper also outlines a proof of the continuum hypothesis and was central in influencing Kurt Gödel to study the completeness and consistency of mathematics leading to Gödel's incompleteness theorem.
A similar function of only two variables was later defined by Rózsa Péter and Raphael Robinson; its definition is given below. The numbers, except in the first few rows, are three less than powers of two. For the exact relation between the two functions, see below.
It may not be immediately obvious that the evaluation of these functions always terminates. The recursion is bounded because in each recursive application either m decreases, or m remains the same and n decreases. Each time that n reaches zero, m decreases, so m eventually reaches zero as well. (Expressed more technically, in each case the pair (m, n) decreases in the lexicographic order, which preserves the well-ordering of the non-negative integers.) However, when m decreases there is no upper bound on how much n can increase — and it will often increase greatly.
The Ackermann function can also be expressed nonrecursively using Conway chained arrow notation:
hence
(n=1 and n=2 would correspond with A(m,−2) = −1 and A(m,−1) = 1, which could logically be added).
or the hyper operators:
For small values of m like 1, 2, or 3, the Ackermann function grows relatively slowly with respect to n (at most exponentially). For m ≥ 4, however, it grows much more quickly; even A(4, 2) is about 2×1019728, and the decimal expansion of A(4, 3) cannot be recorded in the physical universe. If we define the function f (n) = A(n, n), which increases both m and n at the same time, we have a function of one variable that dwarfs every primitive recursive function, including very fast-growing functions such as the exponential function, the factorial function, multi- and superfactorial functions, and even functions defined using Knuth's up-arrow notation (except when the indexed up-arrow is used).
This extreme growth can be exploited to show that f, which is obviously computable on a machine with infinite memory such as a Turing machine and so is a computable function, grows faster than any primitive recursive function and is therefore not primitive recursive. In combination with the Ackermann function's applications in analysis of algorithms, discussed later, this debunks the theory that all useful or simple functions are primitive recursive functions. (But that is not the end of this line of thought: The Busy beaver functions grow faster than any recursive function, and indeed it can be shown that if they could be evaluated in general, we could solve the halting problem so evaluation using an algorithm is impossible.)
One surprising aspect of the Ackermann function is that the only arithmetic operations it ever uses are addition and subtraction of 1. Its properties come solely from the power of unlimited recursion. This also implies that its running time is at least proportional to its output, and so is also extremely huge. In actuality, for most cases the running time is far larger than the output; see below.
| m\n | 0 | 1 | 2 | 3 | 4 | n |
|---|---|---|---|---|---|---|
| 0 | 1 | 2 | 3 | 4 | 5 | |
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 2 | 3 | 5 | 7 | 9 | 11 | |
| 3 | 5 | 13 | 29 | 61 | 125 | |
| 4 | 13 | 65533 | 265536 − 3 | A(3, 265536 − 3) | A(3, A(4, 3)) | |
| 5 | 65533 | A(4, 65533) | A(4, A(5, 1)) | A(4, A(5, 2)) | A(4, A(5, 3)) | |
| 6 | A(5, 1) | A(5, A(5, 1)) | A(5, A(6, 1)) | A(5, A(6, 2)) | A(5, A(6, 3)) |
A(4, 2) is greater than the number of particles in the universe raised to the power 200. A(5, 2) is the item at column A(5, 1) in the m = 4 row, and cannot be written as a decimal expansion in the physical universe. Beyond row 4 and column 1, the values can no longer be feasibly written with any standard notation other than the Ackermann function itself — writing them as decimal expansions, or even as references to rows with lower m, is not possible.
Despite the inconceivably large values occurring in this early section of the table, some even larger numbers have been defined, such as Graham's number, which cannot be written with any small (or, indeed, recordable) number of Knuth arrows. This number is constructed with a technique similar to applying the Ackermann function to itself recursively. Extending the table further to overcome it is like trying the same with the list of natural numbers.
A(1, 2) = A(0, A(1,1)) = A(0, A(0, A(1,0))) = A(0, A(0, A(0,1))) = A(0, A(0, 2)) = A(0, 3) = 4Now let us attempt the more complex A(4, 3), the first value with fairly small n which cannot be recorded as a decimal expansion in the physical universe:
A(4, 3) = A(3, A(4, 2)) = A(3, A(3, A(4, 1))) = A(3, A(3, A(3, A(4, 0)))) = A(3, A(3, A(3, A(3, 1)))) = A(3, A(3, A(3, A(2, A(3, 0))))) = A(3, A(3, A(3, A(2, A(2, 1))))) = A(3, A(3, A(3, A(2, A(1, A(2, 0)))))) = A(3, A(3, A(3, A(2, A(1, A(1, 1)))))) = A(3, A(3, A(3, A(2, A(1, A(0, A(1, 0))))))) = A(3, A(3, A(3, A(2, A(1, A(0, A(0, 1))))))) = A(3, A(3, A(3, A(2, A(1, A(0, 2)))))) = A(3, A(3, A(3, A(2, A(1, 3))))) = A(3, A(3, A(3, A(2, A(0, A(1, 2)))))) = A(3, A(3, A(3, A(2, A(0, A(0, A(1, 1))))))) = A(3, A(3, A(3, A(2, A(0, A(0, A(0, A(1, 0)))))))) = A(3, A(3, A(3, A(2, A(0, A(0, A(0, A(0, 1)))))))) = A(3, A(3, A(3, A(2, A(0, A(0, A(0, 2)))))) = A(3, A(3, A(3, A(2, A(0, A(0, 3))))) = A(3, A(3, A(3, A(2, A(0, 4))))) = A(3, A(3, A(3, A(2, 5)))) = ... = A(3, A(3, A(3, 13))) = ... = A(3, A(3, 65533)) = ...
We stop here because A(3, 65533) returns 265536 − 3, a number which is much larger than the number of atoms in the visible universe. After this, this number is itself raised as a power of 2 to obtain the final result.
This inverse appears in the time complexity of some algorithms, such as the disjoint-set data structure and Chazelle's algorithm for minimum spanning trees. Sometimes Ackermann's original function or other variations are used in these settings, but they all grow at similarly high rates. In particular, some modified functions simplify the expression by eliminating the −3 and similar terms.
A two-parameter variation of the inverse Ackermann function can be defined as follows:
For example, a compiler which, in analyzing the computation of A(3, 30), is able to save intermediate values like the A(3, n) and A(2, n) in that calculation rather than recomputing them, can speed up computation of A(3, 30) by a factor of hundreds of thousands. Also, if A(2, n) is computed directly rather than as a recursive expansion of the form A(1, A(1, A(1,...A(1, 0)...))), this will save significant amounts of time. Computing A(1, n) takes linear time in n. Computing A(2, n) requires quadratic time, since it expands to O(n) nested calls to A(1, i) for various i. Computing A(3, n) requires time proportionate to 4n+1. The computation of A(3, 1) in the example above takes 16 (42) steps.
A(4, 2), which appears as a decimal expansion in several web pages, cannot possibly be computed by recursive application of the Ackermann function in any even remotely plausible amount of time. Instead, formulas such as A(3, n) = 8×2n−3 are used to quickly complete some of the recursive calls.
The are indicative of Knuth's up-arrow notation.
For instance, the first three Ackermann numbers are
An attempt to express the fourth Ackermann number, 44, using iterated exponentiation as above would become extremely complicated. However, it can be expressed using tetration in three layers as follows:
4...44444
︸
4...44444
︸
4444
Arithmetic | Large numbers | Special functions | Theory of computation | Recursion theory
Ackermannova funkce | Ackermannfunktion | Función de Ackermann | Fonction d'Ackermann | Ackermann-függvény | Ackermannfunctie | アッカーマン関数 | Funkcja Ackermanna | Hàm số Ackermann | Ackermann işlevi | 阿克曼函數
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Ackermann function".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world