def ackermann(m,n):
if m == 0:
return n+1
elif n == 0:
return ackermann(m-1,1)
else:
return ackermann(m-1, ackermann(m, n-1))
print("A(0,n) :")
for i in range(0, 10):
print (" A(0,"+str(i)+") = ",str(ackermann(0,i)),sep="")
print("A(1,n) :")
for i in range(0, 10):
print (" A(1,"+str(i)+") = ",str(ackermann(1,i)),sep="")
print("A(2,n) :")
for i in range(0, 10):
print (" A(2,"+str(i)+") = ",str(ackermann(2,i)),sep="")
print("A(3,n) :")
for i in range(0, 7):
print (" A(3,"+str(i)+") = ",str(ackermann(3,i)),sep="")
print("A(4,n) :")
for i in range(0, 1):
print (" A(4,"+str(i)+") = ",str(ackermann(4,i)),sep="")