# Inverse Ackermann Function – GeeksforGeeks

The inverse Ackermann function is the inverse of the Ackermann function, which is a mathematical function defined as follows:

A(m, n) =

• n+1, if m = 0
• A(m-1, 1), if m > 0 and n = 0
• A(m-1, A(m, n-1)), if m > 0 and n > 0

The inverse Ackermann function is the function that returns the pair of integers (m, n) that satisfies the equation A(m, n) = x, where x is a given value. This function is not defined for all values of x, as there are some values of x that do not correspond to any pair of integers (m, n).

### Example of Inverse Ackermann  Function:

For example, To find the pair of integers (m, n) that satisfies the equation A(m, n) = 5, you can use the following steps:

• Set m = 0 and n = 5.
• Evaluate the function A(0, 5) and check if it equals 5. If it does, then the pair of integers (0, 5) is the solution to the equation. If it does not, then go to the next step.
• Set m = 1 and n = 4.
• Evaluate the function A(1, 4) and check if it equals 5. If it does, then the pair of integers (1, 4) is the solution to the equation. If it does not, then go to the next step.
• Repeat this process until you find a pair of integers (m, n) that satisfies the equation A(m, n) = 5, or until you determine that there is no solution to the equation.

This process can be used to find the inverse Ackermann function for any given value of x. The inverse Ackermann function is not a well-defined function, as it is not defined for all values of x, and it is not unique, as there may be multiple pairs of integers (m, n) that satisfy the equation A(m, n) = x.

### How does it grow?

The Ackermann function grows very rapidly, which means that it increases in value very quickly as the input values m and n increase. This rapid growth is due to the recursive nature of the function, which causes it to call itself multiple times for large values of m and n.

For example,

Evaluation of the Ackermann function for m = 4 and n = 1, will give the result A(4, 1) = 65533. This is a very large number, and it is much larger than the result you would get if you evaluated the function for m = 3 and n = 1, which is A(3, 1) = 13.

This rapid growth of the Ackermann function makes it difficult to evaluate the function for large values of m and n, and it also makes it difficult to find the inverse Ackermann function for large values of x. However, despite these limitations, the Ackermann function and the inverse Ackermann function are interesting mathematical objects that have been studied by mathematicians and computer scientists.

### Algorithm with O(α(n)) time complexity, where α(n) is the inverse Ackermann function:

An algorithm with O(α(n)) time complexity, where α(n) is the inverse Ackermann function, is an algorithm that has a time complexity that is bounded by the inverse Ackermann function. This means that the running time of the algorithm is always less than or equal to the value of the inverse Ackermann function for the input size n.

The inverse Ackermann function grows very slowly, which means that it is much smaller than other commonly used time complexity functions such as O(1), O(log n), and O(n). This makes algorithms with O(α(n)) time complexity very efficient, as they can solve large problems in a relatively short amount of time.

Here is an example of an algorithm with O(α(n)) time complexity, where α(n) is the inverse Ackermann function:

## Java

 `import` `java.io.*;` `public` `class` `InverseAckermann {` ` `  `    ``public` `static` `int` `inverseAckermann(``int` `n)` `    ``{` ` `  `        ` `        ` `        ``if` `(n <= ``4``) {` `            ``return` `n;` `        ``}` ` `  `        ` `        ` `        ``int` `a = inverseAckermann(n - ``1``);` `        ``int` `b = inverseAckermann(n - ``2``);` ` `  `        ` `        ` `        ``return` `a + b;` `    ``}` ` `  `    ` `    ``public` `static` `void` `main(String[] args)` `    ``{` ` `  `        ` `        ``int` `n = ``10``;` ` `  `        ` `        ` `        ``int` `result = inverseAckermann(n);` ` `  `        ` `        ``System.out.println(``"Result: "` `+ result);` `    ``}` `}`

Time Complexity: O(α(n))
Space Complexity: O(n)

This algorithm uses a recursive divide-and-conquer approach to solve the problem. It divides the problem into two smaller subproblems, solves them recursively, and then combines the solutions to obtain a solution to the original problem.

The time complexity of this algorithm is O(α(n)), as the running time is bounded by the value of the inverse Ackermann function for the input size n. This means that the algorithm is very efficient and can solve large problems in a relatively short amount of time.