FACTOID # 8: North Korea spends the most of its GDP on its military.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Ackermann function

In recursion theory, the Ackermann function or Ackermann-Péter function is a simple example of a general recursive function that is not primitive recursive. General recursive functions are also known as computable functions. The set of primitive recursive functions is a subset of the set of general recursive functions. Ackermann's function is an example that shows that the former is a strict subset of the latter. Recursion theory, or computability theory, is a branch of mathematical logic dealing with generalizations of the notion of computable function, and with related notions such as Turing degrees and effective descriptive set theory. ... In mathematical logic and computer science, the μ-recursive functions are a class of partial functions from natural numbers to natural numbers which are computable in an intuitive sense. ... In computability theory, primitive recursive functions are a class of functions which form an important building block on the way to a full formalization of computability. ... Computable functions (or Turing-computable functions) are the basic objects of study in computability theory. ... “Superset” redirects here. ... A is a subset of B If X and Y are sets and every element of X is also an element of Y, then we say or write: X is a subset of (or is included in) Y; X ⊆ Y; Y is a superset of (or includes) X; Y...


It takes two natural numbers as arguments and yields another natural number, using the notation A(m,n). Its value grows rapidly; even for small inputs, for example A(4,2)[1] and A(4,3), the results are large numbers. These large numbers in the m=4 row can also be expressed using tetrations. In mathematics, a natural number can mean either an element of the set {1, 2, 3, ...} (i. ... Big numbers redirects here. ... Tetration (also exponential map, hyperpower, power tower, super-exponentiation, and hyper4) is iterated exponentiation, the first hyper operator after exponentiation. ...

Contents

History

In the late 1920s, the mathematicians Gabriel Sudan and Wilhelm Ackermann, students of David Hilbert, were studying the foundations of computation. Sudan is credited with inventing the lesser-known Sudan function, the first published function that is recursive but not primitive recursive. Shortly afterwards and independently, in 1928, Ackermann published his own recursive but not primitive recursive function.[2] Gabriel Sudan was a Romanian mathematician known for the Sudan function, an important example in the theory of computation as the Ackermann function. ... Wilhelm Ackermann (March 29, 1896, Herscheid municipality, Germany – December 24, 1962 Lüdenscheid, Germany ) was a German mathematician best known for the Ackermann function, an important example in the theory of computation. ... David Hilbert (January 23, 1862, Königsberg, East Prussia – February 14, 1943, Göttingen, Germany) was a German mathematician, recognized as one of the most influential and universal mathematicians of the 19th and early 20th centuries. ... In the theory of computation, the Sudan function is an example of a function that is recursive, but not primitive recursive. ... See: Recursion Recursively enumerable language Recursively enumerable set Recursive filter Recursive function Recursive set Primitive recursive function This is a disambiguation page — a list of pages that otherwise might share the same title. ... In computability theory, primitive recursive functions are a class of functions which form an important building block on the way to a full formalization of computability. ...


Ackermann originally considered a function A(mnp) 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 the double exponentiation {{m^{m^m}}}, and with p > 2, it is a tower of exponents {{m^m}^{{cdot}^{{cdot}^{{cdot}^m}}}} 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. Conway chained arrow notation, created by mathematician John Conway, is a means of expressing certain extremely large numbers. ... Tetration (also exponential map, hyperpower, power tower, super-exponentiation, and hyper4) is iterated exponentiation, the first hyper operator after exponentiation. ...


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 computability theory, primitive recursive functions are a class of functions which form an important building block on the way to a full formalization of computability. ... For factorial rings in mathematics, see unique factorisation domain. ...


In On the Infinite, David Hilbert hypothesized that the Ackermann function was not primitively recursive, but it was Ackermann, Hilbert’s personal secretary and former student, 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.[3][4] Hilberts program, formulated by German mathematician David Hilbert in the 1920s, was to formalize all existing theories to a finite, complete set of axioms, and provide a proof that these axioms were consistent. ...


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.[5] Rózsa Péter, (February 17, 1905–February 16, 1977) was a Hungarian mathematician. ... Raphael Mitchel Robinson (November 2, 1911 - January 27, 1995) was an American mathematician. ...


Definition and properties

The Ackermann function is defined recursively for non-negative integers m and n as follows (this presentation is due to Rózsa Péter): This article is about the concept of recursion. ... Rózsa Péter, (February 17, 1905–February 16, 1977) was a Hungarian mathematician. ...

 A(m, n) = begin{cases} n+1 & mbox{if } m = 0  A(m-1, 1) & mbox{if } m > 0 mbox{ and } n = 0  A(m-1, A(m, n-1)) & mbox{if } m > 0 mbox{ and } n > 0. end{cases}

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. In mathematics, the lexicographical order, or dictionary order, is a natural order structure of the cartesian product of two ordered sets. ... In mathematics, a well-order (or well-ordering) on a set S is a total order on S with the property that every non-empty subset of S has a least element in this ordering. ...


The Ackermann function can also be expressed nonrecursively using:

A(m, n) = (2 → (n+3) → (m − 2)) − 3 for m > 2
hence
2 → nm = A(m+2,n-3) + 3 for n>2
(n=1 and n=2 would correspond with A(m,−2) = −1 and A(m,−1) = 1, which could logically be added.)
A(m, n) = hyper(2, m, n + 3) − 3
  • the indexed version of Knuth's up-arrow notation:
A(m, n) = 2uparrow^{m-2} (n+3) - 3
The part of the definition A(m, 0) = A(m-1, 1) corresponds to 2uparrow^{m+1} 3=2uparrow^m 4.

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) is very large by any typical measure. Conway chained arrow notation, created by mathematician John Conway, is a means of expressing certain extremely large numbers. ... The hyper operators forming the hypern family are as follows: hypern (a, b) = (See Knuths up-arrow notation and Conway chained arrow notation. ... In mathematics, Knuths up-arrow notation is a notation for very large integers introduced by Donald Knuth in 1976. ... In mathematics, exponential growth (or geometric growth) occurs when the growth rate of a function is always proportional to the functions current size. ...


If we define the function f (n) = A(nn), 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). The exponential function is one of the most important functions in mathematics. ... In mathematics, the factorial of a natural number n is the product of the positive integers less than or equal to n. ...


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. Though the Ackermann function is often used to debunk the hypothesis that all useful or simple functions are primitive recursive, one should not confuse the primitive recursive functions with those definable by primitive recursion (it is this latter class that is of interest to programming language theorists because programs written using only primitive recursion are guaranteed to terminate). In a category with exponentials, using the isomorphism A times B rightarrow C cong A rightarrow (B rightarrow C), the Ackermann function may be defined via primitive recursion over higher-order functionals as follows: For the test of artificial intelligence, see Turing test. ... Computable functions (or Turing-computable functions) are the basic objects of study in computability theory. ...

 begin{array}{lcl} Ack(0) & = & Succ  Ack(m+1) & = & Iter(Ack(m-1)) end{array}

where Succ is the usual successor function and Iter is defined by primitive recursion as well:

 begin{array}{lcl} Iter(f)(0) & = & f(1)  Iter(f)(n+1) & = & f(Iter(f)(n)) end{array}

Another interesting class of functions are the Busy beaver functions, which 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. In computability theory, a Busy Beaver (from the colloquial expression for industrious person) is a Turing machine that, when given an empty tape, does a lot of work, then halts. ... In computability theory the halting problem is a decision problem which can be stated as follows: Given a description of a program and a finite input, decide whether the program finishes running or will run forever, given that input. ...


One interesting 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. This article is about the concept of recursion. ...


Table of values

Computing the Ackermann function can be restated in terms of an infinite table. We place the natural numbers along the top row. To determine a number in the table, take the number immediately to the left, then look up the required number in the previous row, at the position given by the number just taken. If there is no number to its left, simply look at column 1 in the previous row. Here is a small upper-left portion of the table:

Values of A(mn)
mn 0 1 2 3 4 n
0 1 2 3 4 5 n + 1
1 2 3 4 5 6 n + 2
2 3 5 7 9 11 2n + 3
3 5 13 29 61 125 2(n + 3) − 3
4 13 65533 265536 − 3 {2^{2^{65536}}} - 3 A(3, A(4, 3)) begin{matrix}underbrace{{2^2}^{{cdot}^{{cdot}^{{cdot}^2}}}} - 3 nmbox{ + 3 twos}end{matrix}
5 65533 A(4, 65533) A(4, A(5, 1)) A(4, A(5, 2)) A(4, A(5, 3)) A(4, A(5, n-1))
6 A(5, 1) A(5, A(6, 0)) A(5, A(6, 1)) A(5, A(6, 2)) A(5, A(6, 3)) A(5, A(6, n-1))

The numbers listed here in a recursive reference are very large and cannot be easily notated in some other form.


Despite the 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 number of Knuth arrows. This number is constructed with a technique similar to applying the Ackermann function to itself recursively. Grahams number, named after Ronald Graham, is often described as the largest number that has ever been seriously used in a mathematical proof. ... In mathematics, Knuths up-arrow notation is a notation for very large integers introduced by Donald Knuth in 1976. ...


This is a repeat of the above table, but with the values replaced by the relevant expression from the function definition to show the pattern clearly:

Values of A(mn)
mn 0 1 2 3 4 n
0 0+1 1+1 2+1 3+1 4+1 n + 1
1 A(0,1) A(0,A(1,0)) A(0,(A(1,1)) A(0,(A(1,2)) A(0,(A(1,3)) n + 2
2 A(1,1) A(1,(A(2,0)) A(1,(A(2,1)) A(1,(A(2,2)) A(1,(A(2,3)) 2n + 3
3 A(2,1) A(2,(A(3,0)) A(2,(A(3,1)) A(2,(A(3,2)) A(2,(A(3,3)) 2(n + 3) − 3
4 A(3,1) A(3,(A(4,0)) A(3,(A(4,1)) A(3,(A(4,2)) A(3,(A(4,3))

begin{matrix}underbrace{{2^2}^{{cdot}^{{cdot}^{{cdot}^2}}}} - 3 nmbox{ + 3 twos}end{matrix}

5 A(4,1) A(4,(A(5,0)) A(4,(A(5,1)) A(4,(A(5,2)) A(4,(A(5,3))

A(4, A(5, n-1))

6 A(5,1) A(5,(A(6,0)) A(5,(A(6,1)) A(5,(A(6,2)) A(5,(A(6,3))

A(5, A(6, n-1))

Expansion

To see how the Ackermann function grows so quickly, it helps to expand out some simple expressions using the rules in the original definition. For example, we can fully evaluate A(1,2) in the following way:

begin{align} 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)  & = 4 end{align}

To demonstrate how A(4,3)'s computation results many steps and in a large number:

begin{align} 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))  & = ...  end{align}

We stop here because A(3,65533) is 265536 − 3 which is a short expression that still represents a large number. According to the formula for A(3,n) in the table above, the plus and minus three cancel out and the end result uses 265536 which is then, itself raised as a power of 2 and then 3 subtracted to obtain the final result, which is a vastly larger number yet.


Inverse

Since the function  f (n) = A(nn) considered above grows very rapidly, its inverse function, f−1, grows very slowly. This inverse Ackermann function f−1 is usually denoted by α. In fact, α(n) is less than 5 for any conceivable input size n, since A(4, 4) is a large number. "For all practical purposes", α(n) can be regarded as being a constant. In mathematics, an inverse function is in simple terms a function which does the reverse of a given function. ...


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. As a branch of the theory of computation in computer science, computational complexity theory describes the scalability of algorithms, and the inherent difficulty in providing scalable algorithms for specific computational problems. ... In mathematics, computing, linguistics, and related disciplines, an algorithm is a finite list of well-defined instructions for accomplishing some task that, given an initial state, will terminate in a defined end-state. ... Given a set of elements, it is often useful to break them up or partition them into a number of separate, nonoverlapping sets. ... The minimum spanning tree of a planar graph. ...


A two-parameter variation of the inverse Ackermann function can be defined as follows:

alpha(m,n) = min{i geq 1 : A(i,lfloor m/n rfloor) geq log_2 n}.

This function arises in more precise analyses of the algorithms mentioned above, and gives a more refined time bound. In the disjoint-set data structure, m represents the number of operations while n represents the number of elements; in the minimum spanning tree algorithm, m represents the number of edges while n represents the number of vertices. Several slightly different definitions of α(mn) exist; for example, log2 n is sometimes replaced by n, and the floor function is sometimes replaced by a ceiling. The floor and fractional part functions In mathematics, the floor function of a real number x, denoted or floor(x), is the largest integer less than or equal to x (formally, ). For example, floor(2. ... In mathematics, the floor function is the function defined as follows: for a real number x, floor(x) is the largest integer less than or equal to x. ...


Other studies might define an inverse function of one where m is set to a constant, such that the inverse applies to a particular row.[6]


Use as benchmark

The Ackermann function, due to its definition in terms of extremely deep recursion, can be used as a benchmark of a compiler's ability to optimize recursion. The first use of Ackermann's function in this way was by Y. Sundblad, The Ackermann function. A Theoretical, computational and formula manipulative study. (BIT 11 (1971), 107119). A diagram of the operation of a typical multi-language, multi-target compiler. ...


This seminal paper was taken up by Brian Wichmann (co-author of the Whetstone benchmark) in a trilogy of papers written between 1975 and 1982.[7][8][9] The Whetstone benchmark is a benchmark for evaluating the performance of computers. ...


A more recent use of Ackermann's function as a compiler benchmark is in The Computer Language Shootout which compares the time required to evaluate this function for fixed arguments in many different programming language implementations.[10][11]


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. For other uses, see Big O. In computational complexity theory, big O notation is often used to describe how the size of the input data affects an algorithms usage of computational resources (usually running time or memory). ...


A(4, 2), which appears as a decimal expansion in several web pages, cannot possibly be computed by simple recursive application of the Ackermann function in any tractable amount of time. Instead, shortcut formulas such as A(3, n) = 8×2n−3 are used as an optimization to complete some of the recursive calls.


A practical method of computing functions similar to Ackermann's is to use memoization of intermediate results. A compiler could apply this technique to a function automatically using Donald Michie's "memo functions".[12][citation needed] Memoization is a technique used to speed up computer programs by storing the results of functions for later reuse, rather than recomputing them. ... Donald Michie was born on 11 November 1923, and was educated at Rugby School and Balliol College, Oxford. ...


Implementations

The first implementation in a programming language was in Fortran in 1964, see H. Gordon Rice[13], Recursion and iteration, Commun. ACM, 8(2), 1965, pp. 114--115.)


In Matlab: Not to be confused with Matlab Upazila in Chandpur District, Bangladesh. ...

 function out = ackermann(m,n) if m == 0 out = n+1; return elseif (m > 0 && n == 0) out = ackermann(m-1, 1); return elseif (m > 0 && n > 0) out = ackermann(m-1, ackermann(m, n-1)); end return 

In Scheme: Scheme is a multi-paradigm programming language. ...

 (define (ackermann m n) (cond ((= m 0) (+ 1 n)) ((= n 0) (ackermann (- m 1) 1)) ((> n 0) (ackermann (- m 1) (ackermann m (- n 1)))))) 

In Haskell: Haskell is a standardized purely functional programming language with non-strict semantics, named after the logician Haskell Curry. ...

 ackermann 0 n = (n + 1) ackermann m 0 = ackermann (m-1) 1 ackermann m n = ackermann (m-1) (ackermann m (n-1)) 

In ML: ML is a general-purpose functional programming language developed by Robin Milner and others in the late 1970s at the University of Edinburgh, whose syntax is inspired by ISWIM. Historically, ML stands for metalanguage as it was conceived to develop proof tactics in the LCF theorem prover (the language of...

 fun ackermann (0,n) = n + 1 | ackermann (m,0) = ackermann (m-1, 1) | ackermann (m,n) = ackermann (m-1, ackermann (m, n-1)); 

In Prolog: Prolog is a logic programming language. ...

 ackermann(0, N, A) :- integer(N), N >= 0 -> A is N + 1. 
ackermann(M, 0, A) :- integer(M), M >= 0 -> M1 is M - 1, ackermann(M1, 1, A).
ackermann(M, N, A) :- integer(M), M >= 1, integer(N), N >= 1 -> N1 is N - 1, ackermann(M, N1, A1), M1 is M - 1, ackermann(M1, A1, A).

In Ocaml: Objective Caml (OCaml) is the main implementation of the Caml programming language, created by Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy and others in 1996. ...

 let rec ackermann = function (0, n) -> n + 1 | (m, 0) -> ackermann (m-1, 1) | (m, n) -> ackermann (m-1, ackermann (m, n-1)) 

In C: C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ...

 int ackermann(int m, int n) { if (m == 0) return n+1; else if (m > 0 && n == 0) return ackermann(m-1, 1); else if (m > 0 && n > 0) return ackermann(m-1, ackermann(m, n-1)); } 

In Python: Python is a high-level programming language first released by Guido van Rossum in 1991. ...

 def ackermann(m, n): if m == 0: return n+1 elif m > 0 and n == 0: return ackermann(m-1, 1) elif m > 0 and n > 0: return ackermann(m-1, ackermann(m, n-1)) 

In Perl: Wikibooks has a book on the topic of Perl Programming Perl is a dynamic programming language created by Larry Wall and first released in 1987. ...

 sub ackermann { my($m, $n) = @_; return $n+1 if $m == 0; return ackermann($m-1, 1) if $m > 0 && $n == 0; return ackermann($m-1, ackermann($m, $n-1)) if $m > 0 && $n > 0; } 

In Ruby: Ruby is a reflective, dynamic, object-oriented programming language. ...

 def ackermann(m,n) if m==0 n+1 elsif m > 0 && n==0 ackermann(m-1,1) elsif m > 0 && n > 0 ackermann(m-1,ackermann(m,n-1)) end end 

In Java: “Java language” redirects here. ...

 public static int ackermann(int m, int n) { if (m == 0) return n+1; else if (m > 0 && n == 0) return ackermann(m-1, 1); else return ackermann(m-1, ackermann(m, n-1)); } 

In Turing: The logo for the turing programming language Turing is a Pascal-like programming language developed in 1982 by Ric Holt and James Cordy, then of University of Toronto, Canada. ...

 function ackermann (m : int, n : int) : int if m = 0 then result n + 1 elsif m > 0 and n = 0 then result A (m - 1, 1) else result A (m - 1, A (m, n - 1)) end if end A 

In Ada: Ada is a structured, statically typed, imperative, and object-oriented high-level computer programming language. ...

 function Ackermann(m, n : Integer) return Integer is begin if m < 0 or n < 0 then raise Ada.Numerics.Argument_Error; end if; if m = 0 then return n + 1; elsif n = 0 then return Ackermann(m - 1, 1); else return Ackermann(m - 1, Ackermann(m, n - 1)); end if; end Ackermann; 

In MIPS assembly: A MIPS R4400 microprocessor made by Toshiba. ...

 ackerman: #Hmm, if m == o just return 1 addi $v0, $a1, 1 #We set our return value to 1 beq $a0, $zero, end #and if a0 == 0 we end it! #oh, we're gonna make some function calls, get ready! addi $sp, -8 #Make the stack bigger for registes you'll use sw $ra, 0($sp) #Save $s- variables sw $s0, 4($sp) #Save $ra variables bne $a1, $zero, fatrec #run the following if n == 0 addi $a0, $a0, -1 #set first arg to m - 1 addi $a1, $zero, 1 #set the second arg to 1 jal ackerman j clean fatrec: #recursing twice! add $s0, $a0, $zero addi $a1, $a1, -1 jal ackerman addi $a0, $s0, -1 add $a1, $v0, $zero jal ackerman clean: lw $s0, 4($sp) #Restore $s- variables lw $ra, 0($sp) #Restore $ra variables addi $sp, $sp, 8 #restore stack pointer end: jr $ra #Jump to where we came from 

Non-Recursive Ackermann in Python

This algorithm uses a software stack much like Reverse Polish notation Python is a high-level programming language first released by Guido van Rossum in 1991. ... Postfix notation is a mathematical notation wherein every operator follows all of its operands. ...

 def Ackermann(m, n): stack = [] stack.append(m) stack.append(n) while len(stack) > 1: n = stack.pop() m = stack.pop() if m == 0: stack.append(n + 1) elif n == 0: stack.append(m-1) stack.append(1) else: stack.append(m-1) stack.append(m) stack.append(n-1) return stack.pop() 

Non-Recursive Ackermann in C++

 int Ackermann( int n, int m) { stack stk; int rt,ff,x=NULL,y=NULL,z=NULL; bool exit = false; do{ while( n != 0 ) { if( m == 0 ){ rt = 1; stk.push( rt ); stk.push( n ); stk.push( m ); stk.push( x ); stk.push( y ); stk.push( z ); m = 1; n = n - 1;} else{ rt = 2; stk.push( rt ); stk.push( n ); stk.push( m ); stk.push( x ); stk.push( y ); stk.push( z ); m = m - 1;} } ff = m + 1; exit = false; while( stk.tos > -1 && exit == false ) { z = stk.pop(); y = stk.pop(); x = stk.pop(); m = stk.pop(); n = stk.pop(); rt = stk.pop(); if( rt == 3 )z = ff; else if( rt == 2 ){ y = ff; rt = 3; stk.push( rt ); stk.push( n ); stk.push( m ); stk.push( x ); stk.push( y ); stk.push( z ); m = y; n = n - 1; exit = true;} } }while( stk.tos > -1 ); return ff; } 

C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ...

And here is the algorithm of above code:

Image File history File links Metadata No higher resolution available. ...


Ackermann numbers

Related to the Ackermann function but in fact different are the Ackermann numbers, a sequence where the nth term equals: For other senses of this word, see sequence (disambiguation). ...

 begin{matrix} n underbrace{uparrowdotsuparrow} n  n end{matrix}

in the Knuth's up-arrow notation, or In mathematics, Knuths up-arrow notation is a notation for very large integers introduced by Donald Knuth in 1976. ...

  • n to n to n

in the Conway chained arrow notation.[14] Conway chained arrow notation, created by mathematician John Conway, is a means of expressing certain extremely large numbers. ...


For instance, the first three Ackermann numbers are

  • 1uparrow1,
  • 2uparrowuparrow2
  • 3uparrowuparrowuparrow3

which equal the following:

  • 1 = 1
  • 22 = 4
  • { ^{^{^3}3}3} = 3uparrowuparrow3uparrowuparrow3 = begin{matrix} underbrace{qquadquad3^{3^{3^{3^{3^{3^{.^{.^{.^{3}}}}}}}}}qquadquad}  3^{27}{rm or } 7625597484987{rm threes}end{matrix}


An attempt to express the fourth Ackermann number, 4uparrowuparrowuparrowuparrow4, using iterated exponentiation as above would become extremely complicated. However, it can be expressed using tetration in three nested layers as shown below. Explanation: in the middle layer, there is a tower of tetration whose full length is ^{^{^{^4}4}4}4 and the final result is the top layer of tetrated 4's whose full length equals the calculation of the middle layer. Note that by way of size comparison, the simple expression ^{^4}4 already exceeds a googolplex, so the fourth Ackermann number is quite large. “Exponent” redirects here. ... Tetration (also exponential map, hyperpower, power tower, super-exponentiation, and hyper4) is iterated exponentiation, the first hyper operator after exponentiation. ... This article is about a number. ...

begin{matrix} underbrace{begin{matrix} underbrace{^{^{^{^{^{^{^{4}.}.}.}4}4}4}4}  ^{^{^{^{^{^{^{4}.}.}.}4}4}4}4 end{matrix}}  ^{^{^{^4}4}4}4 end{matrix}

In popular culture

Randall Munroe has mentioned the Ackermann function in his popular web-comic xkcd.[15] In the comic, Munroe makes reference to the Ackermann function with Graham's number as the arguments. At the time, he considered this to be the largest number ever concisely defined and named it "The xkcd number".[16] Randall Munroe speaking at MIT. Randall Patrick Munroe (born October 17, 1984) is a self-described pen/pencil operator and programmer best known for creating the webcomic xkcd. ... xkcd is a webcomic created by Randall Munroe,[1] a Christopher Newport University graduate who worked as a contractor for NASA.[2] It calls itself a webcomic of romance, sarcasm, math, and language. ... Grahams number, named after Ronald Graham, is often described as the largest number that has ever been seriously used in a mathematical proof. ...


See also

Tetration (also exponential map, hyperpower, power tower, super-exponentiation, and hyper4) is iterated exponentiation, the first hyper operator after exponentiation. ... In computability theory, a Busy Beaver (from the colloquial expression for industrious person) is a Turing machine that, when given an empty tape, does a lot of work, then halts. ... In computer science, computability theory is the branch of the theory of computation that studies which problems are computationally solvable using different models of computation. ... Charity is a purely functional experimental programming language, developed at Calgary. ...

Notes and references

  1. ^ Decimal expansion of A(4,2) contains 19729 decimal digits
  2. ^ Cristian Calude, Solomon Marcus and Ionel Tevy (November 1979). "The first example of a recursive function which is not primitive recursive". Historia Math. 6 (4): 380–84.  Summarized in Bill Dubuque (1997-09-12). "Ackermann vs. Sudan". sci.logic. (Google Groups). Retrieved on 2006-06-13.
  3. ^ Wilhelm Ackermann (1928). "Zum Hilbertschen Aufbau der reellen Zahlen". Mathematische Annalen 99: 118–133. 
  4. ^ von Heijenoort. From Frege To Gödel, 1967.
  5. ^ Raphael M. Robinson (1948). "Recursion and Double Recursion". Bulletin of the American Mathematical Society 54: 987–93. 
  6. ^ An inverse-Ackermann style lower bound for the online minimum spanning tree verification problem November 2002
  7. ^ Ackermann's Function: A Study In The Efficiency Of Calling Procedures (1975).
  8. ^ How to Call Procedures, or Second Thoughts on Ackermann's Function (1977).
  9. ^ Latest results from the procedure calling test, Ackermann's function (1982).
  10. ^ Gentoo: Intel Pentium 4 Computer Language Shootout (2006). Retrieved on 2006-06-13.
  11. ^ Benchmarks XGC, May 11, 2005
  12. ^ Example: Explicit memo function version of Ackermann's function implemented in PL/SQL
  13. ^ The author of Rice's theorem !
  14. ^ Ackermann Number
  15. ^ "What xkcd Means". Retrieved on 2007-06-25.
  16. ^ "The Clarkkkkson vs. the xkcd Number". Retrieved on 2007-06-25.

Dr. Solomon Marcus is a member of the Mathematical Section of the Romanian Academy and Emeritus Professor of the University of Bucharest. ... For the band, see 1997 (band). ... is the 255th day of the year (256th in leap years) in the Gregorian calendar. ... Year 2006 (MMVI) was a common year starting on Sunday of the Gregorian calendar. ... is the 164th day of the year (165th in leap years) in the Gregorian calendar. ... The Mathematische Annalen is a German mathematical research journal published by Springer-Verlag. ... The American Mathematical Society (AMS) is dedicated to the interests of mathematical research and education, which it does with various publications and conferences as well as annual monetary awards to mathematicians. ... Year 2006 (MMVI) was a common year starting on Sunday of the Gregorian calendar. ... is the 164th day of the year (165th in leap years) in the Gregorian calendar. ... Rices theorem (also known as The Rice-Myhill-Shapiro theorem) is an important result in the theory of recursive functions. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 176th day of the year (177th in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 176th day of the year (177th in leap years) in the Gregorian calendar. ...

External links

Dr. Eric W. Weisstein Encyclopedist Dr. Eric W. Weisstein (born March 18, 1969, in Bloomington, Indiana) is a noted encyclopedist in several technical areas of science and mathematics. ... MathWorld is an online mathematics reference work, sponsored by Wolfram Research Inc. ... NIST logo The National Institute of Standards and Technology (NIST, formerly known as The National Bureau of Standards) is a non-regulatory agency of the United States Department of Commerce’s Technology Administration. ... The Dictionary of Algorithms and Data Structures is maintained by Paul E. Black, and is hosted by the Software Quality Group of the Software Diagnostics and Conformance Testing Division, Information Technology Laboratory, a part of the National Institute of Standards and Technology. ...


  Results from FactBites:
 
PlanetMath: Ackermann function (161 words)
Ackermann's function is an example of a recursive function that is not primitive recursive, but is instead
Later this was simplified by Rosza Peter to a function of two variables, similar to the one given above.
This is version 6 of Ackermann function, born on 2002-03-23, modified 2004-03-30.
Ackermann function - Wikipedia, the free encyclopedia (1936 words)
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.
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.
The Ackermann function, due to its definition in terms of extremely deep recursion, can be used as a benchmark of a compiler's ability to optimize recursion.
  More results at FactBites »


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m