Problem 734. Ackermann's Function
Ackermann's Function is a recursive function that is not 'primitive recursive.'
The first argument drives the value extremely fast.
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
A(2,4)=A(1,A(2,3)) = ... = 11.
% Range of cases % m=0 n=0:1024 % m=1 n=0:1024 % m=2 n=0:128 % m=3 n=0:6 % m=4 n=0:1
There is some deep recusion.
Input: m,n
Out: Ackerman value
Ackermann(2,4) = 11
Practical application of Ackermann's function is determining compiler recursion performance.
Solution Stats
Problem Comments
-
2 Comments
Solution 15 is, to me, a novel cell array index implementation.
Efficiently to crash my Matlab.
Solution Comments
Show commentsProblem Recent Solvers78
Suggested Problems
-
622 Solvers
-
Convert from Base 10 to base 5
274 Solvers
-
Circular Primes (based on Project Euler, problem 35)
640 Solvers
-
Convert given decimal number to binary number.
2233 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
2086 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!