Cody

Problem 734. Ackermann's Function

Solution 3623283

Submitted on 11 Nov 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
m=0; n=1; Ack = n+1; assert(isequal(ackermann(m,n),Ack))

Output argument "vAck" (and maybe others) not assigned during call to "ackermann". Error in Test1 (line 4) assert(isequal(ackermann(m,n),Ack))

2   Fail
m=0; n=1024; Ack = n+1; assert(isequal(ackermann(m,n),Ack))

Output argument "vAck" (and maybe others) not assigned during call to "ackermann". Error in Test2 (line 4) assert(isequal(ackermann(m,n),Ack))

3   Fail
m=0; n=randi(1024) Ack = n+1; assert(isequal(ackermann(m,n),Ack))

n = 956

Output argument "vAck" (and maybe others) not assigned during call to "ackermann". Error in Test3 (line 4) assert(isequal(ackermann(m,n),Ack))

4   Fail
m=1; n=1024 Ack = n+2; assert(isequal(ackermann(m,n),Ack))

n = 1024

Undefined function 'ack' for input arguments of type 'double'. Error in ackermann (line 23) a = ackermann(m-1,ack(m,n-1)); % Recursive self-recall Error in Test4 (line 4) assert(isequal(ackermann(m,n),Ack))

5   Fail
m=1; n=randi(1024) Ack = n+2; assert(isequal(ackermann(m,n),Ack))

n = 693

Undefined function 'ack' for input arguments of type 'double'. Error in ackermann (line 23) a = ackermann(m-1,ack(m,n-1)); % Recursive self-recall Error in Test5 (line 4) assert(isequal(ackermann(m,n),Ack))

6   Fail
m=2; n=randi(128) Ack = 2*n+3; assert(isequal(ackermann(m,n),Ack))

n = 33

Undefined function 'ack' for input arguments of type 'double'. Error in ackermann (line 23) a = ackermann(m-1,ack(m,n-1)); % Recursive self-recall Error in Test6 (line 4) assert(isequal(ackermann(m,n),Ack))

7   Fail
m=3; n=6; Ack = 509; assert(isequal(ackermann(m,n),Ack))

Undefined function 'ack' for input arguments of type 'double'. Error in ackermann (line 23) a = ackermann(m-1,ack(m,n-1)); % Recursive self-recall Error in Test7 (line 4) assert(isequal(ackermann(m,n),Ack))

8   Fail
m=3; n=randi(6) Ack = 2^(n+3)-3; assert(isequal(ackermann(m,n),Ack))

n = 5

Undefined function 'ack' for input arguments of type 'double'. Error in ackermann (line 23) a = ackermann(m-1,ack(m,n-1)); % Recursive self-recall Error in Test8 (line 4) assert(isequal(ackermann(m,n),Ack))

9   Fail
m=4; n=0; Ack = 13; assert(isequal(ackermann(m,n),Ack))

Undefined function 'ack' for input arguments of type 'double'. Error in ackermann (line 23) a = ackermann(m-1,ack(m,n-1)); % Recursive self-recall Error in ackermann (line 18) a = ackermann(m-1,1); Error in Test9 (line 4) assert(isequal(ackermann(m,n),Ack))

10   Fail
m=4; n=1; % Fails at RecursionLimit 1030; Create Special Ack = 65533; assert(isequal(ackermann(m,n),Ack))

Undefined function 'ack' for input arguments of type 'double'. Error in ackermann (line 23) a = ackermann(m-1,ack(m,n-1)); % Recursive self-recall Error in Test10 (line 4) assert(isequal(ackermann(m,n),Ack))

Suggested Problems

More from this Author246

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!