In computability theory, the Ackermann function, named after Wilhelm Ackermann, is one of the simplest and earliest-discovered examples of a total computable function that is not primitive recursive. All primitive recursive functions are total and computable, but the Ackermann function illustrates that not all total computable functions are primitive recursive.
The Ackermann function, due to its definition in terms of extremely deep recursion, can be used as a benchmark of a computer’s ability to optimize recursion.
Read more on WikiPedia
The following code demonstrates Ackermann’s function in a recursive way
Please use the above code as a concept only to understand Ackermann’s function. There are more optimal ways to compute the function. See below: