Inverse Ackermann Function
Last Updated :
10 Jan, 2023
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:
C++
#include <iostream>
using namespace std;
int inverseAckermann(int n)
{
if (n <= 4) {
return n;
}
int a = inverseAckermann(n - 1);
int b = inverseAckermann(n - 2);
return a + b;
}
int main()
{
int n = 10;
int result = inverseAckermann(n);
cout << "Result: " << result << endl;
return 0;
}
|
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);
}
}
|
Python3
def inverse_ackermann(n):
if n <= 4:
return n
a = inverse_ackermann(n - 1)
b = inverse_ackermann(n - 2)
return a + b
n = 10
result = inverse_ackermann(n)
print("Result:", result)
|
C#
using System;
public class GFG{
public static int inverseAckermann(int n)
{
if (n <= 4) {
return n;
}
int a = inverseAckermann(n - 1);
int b = inverseAckermann(n - 2);
return a + b;
}
static public void Main (){
int n = 10;
int result = inverseAckermann(n);
Console.WriteLine("Result: " + result);
}
}
|
Javascript
function inverseAckermann(n)
{
if (n <= 4) {
return n;
}
let a = inverseAckermann(n - 1);
let b = inverseAckermann(n - 2);
return a + b;
}
let n = 10;
let result = inverseAckermann(n);
document.write("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.
Similar Reads
Inverse Ackermann Function
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 = 0A(m-1, 1), if m > 0 and n = 0A(m-1, A(m, n-1)), if m > 0 and n > 0 The inverse Ackermann function is the function that returns the pair of int
7 min read
Ackermann Function
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 t
6 min read
What is an inverse function?
Mathematics is a subject with various disciplines and subtopics. Arithmetics, geometry, exponential, percentage are some of these branches of mathematics that deal with the calculation, analysis, and manipulation of numbers as well as symbols. Algebra is also one of the disciplines of mathematics th
4 min read
Derivatives of Inverse Functions
In mathematics, a function(e.g. f), is said to be an inverse of another(e.g. g), if given the output of g returns the input value given to f. Additionally, this must hold true for every element in the domain co-domain(range) of g. E.g. assuming x and y are constants if g(x) = y and f(y) = x then the
12 min read
Can a function be equal to its inverse?
Answer: Yes, a Function Can be equal to its inverse.A function is a special type of relation or mapping between a given set of input values (called domain) and a set of outputs (called co-domain) where each value of the domain has a unique image in the co-domain (called range in this case). This mea
6 min read
Inverse Hyperbolic Functions Formula
In mathematics, the inverse functions of hyperbolic functions are referred to as inverse hyperbolic functions or area hyperbolic functions. There are six inverse hyperbolic functions, namely, inverse hyperbolic sine, inverse hyperbolic cosine, inverse hyperbolic tangent, inverse hyperbolic cosecant,
15 min read
valarray atan2() function in C++
The atan2() function is defined in valarray header file. This function calculate inverse tangent of (y/x) value of each element in valarray and returns a valarray containing the inverse tangent of all the elements. where y is the proportion of the y-coordinate and x is the proportion of the x-coordi
3 min read
Ackermann's function using Dynamic programming
Given two non-zero integers M and N, the problem is to compute the result of the Ackermann function based on some particular equations. Ackermann function is defined as: Examples: Input: M = 2, N = 2Output: 7 Input: M = 2, N = 7Output: 6141004759 The approach for Ackermann function described in this
13 min read
Inverse functions and composition of functions
Inverse Functions - In mathematics a function, a, is said to be an inverse of another, b, if given the output of b a returns the input value given to b. Additionally, this must hold true for every element in the domain co-domain(range) of b. In other words, assuming x and y are constants, if b(x) =
3 min read
How to Find the Inverse of a Function
In math, finding the inverse of a function means undoing what the original function does. The inverse switches the input and output of the original function. But not all functions have inverses; there are rules to for an inverse to exist for a function. This article looks at the steps to find a func
8 min read
Verifying Inverse Functions by Composition
A function can be seen as a mathematical formula or a machine that throws output when an input is given. The output is usually some processed version of the input. Function's inverses can be seen as the operations which give us the input back on giving them the output. In other words, inverse functi
5 min read
Cube Root Function
Cube root of a number is denoted as f(x) = ∛x or f(x) = x1/3, where x is any real number. It is a number which, when raised to the power of 3, equals to x. The cube root function is the inverse of the cubic function f(x) = x3. A cube root function is a one-one and onto function. In this article, we
11 min read
Function Notation Formula
A function is a type of operator that takes an input variable and provides a result. When one quantity is dependent on another, a function is created. An interesting property of functions is that each input corresponds to a single output. In other words, such an operator between two sets, say set A
4 min read
Ceiling Function
Ceiling Function is an important function in mathematics that returns the smallest integer which is not smaller than the input decimal. It is usually expressed as a function of a variable and denoted either by f(x) or by ceil(x) or ⌈x⌉. Ceiling Function has applications in various fields such as phy
7 min read
Arcsine Function
Arcsine function, commonly written as arcsin(x) or sometimes as sin⁻¹(x), is the inverse of the sine function. It allows us to determine the angle whose sine is a given value. For example, if the sine of an angle is 0.5, the arcsine of 0.5 will give the angle, which in this case is 30 degrees or π/6
4 min read
Derivatives of Inverse Trigonometric Functions
Derivatives of Inverse Trigonometric Functions: Every mathematical function, from the simplest to the most complex, has an inverse. In mathematics, the inverse usually means the opposite. In addition, the inverse is subtraction. For multiplication, it's division. In the same way for trigonometric fu
14 min read
Derivative of Inverse Trigonometric Functions
Derivative of Inverse Trigonometric Function refers to the rate of change in Inverse Trigonometric Functions. We know that the derivative of a function is the rate of change in a function with respect to the independent variable. Before learning this, one should know the formulas of differentiation
11 min read
map rbegin() function in C++ STL
The rbegin() is a function in C++ STL. It returns a reverse iterator which points to the last element of the map. The reverse iterator iterates in reverse order and incrementing it means moving towards beginning of map. SYNTAX: r_i rbegin(); const_r_i rbegin() const; Parameters: It does not except a
1 min read
What is the Arctan Function in Trigonometry?
Trigonometry is a branch that deals with the evaluation of sides and angles of a right-angled triangle. The trigonometric operations involve the calculation for sides, angles, and trigonometric ratios. The trigonometric ratios are defined as the values of trigonometric functions which are derived fr
3 min read