Write a method to recursively computer the ackermann


You need help with this part 1 and 2, please

The Ackermann Function

Part 1

The Ackermann function is a function created by Wilhelm Ackermann in the late 1920s. For non-negative integers m and n, the Ackermann function is defined as

A(m,n)= n+1 if m=0

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

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

Write a method to recursively computer the Ackermann function. Note that the Ackermann function grows extremely quickly for even small values of m and n. Test your method with the following values but be aware that if m is greater than 3 and n is greater than 1, it will take a very long time to compute.


n

m

0

1

2

3

4

5

6

7

8

9

10

0

1

2

3

4

5

6

7

8

9

10

11

1

2

3

4

5

6

7

8

9

10

11

12

2

3

5

7

9

11

13

15

17

19

21

23

3

5

13

29

61

125

253

509

1021

2045

4093

8189

Part 2: 

Write a recursive method called writeNums that takes an integer n as a parameter and prints to the console the first n integers starting with 1 in sequential order, separated by commas. For example, consider the following calls:

writeNums(5);    // would produce 1, 2, 3, 4, 5

writeNums(12);   //would produce 1, 2, 3, 4, 5, 6, 7, 8, 8, 10, 11, 12

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a method to recursively computer the ackermann
Reference No:- TGS02871241

Expected delivery within 24 Hours