The Python code below could be used to evaluate the Ankermann function.
def ack(m,n):
if m == 0:
return n+1
elif m > 0:
if n == 0:
return ack(m-1, 1)
elif n > 0:
return ack(m-1, ack(m, n-1))
Usage:if m == 0:
return n+1
elif m > 0:
if n == 0:
return ack(m-1, 1)
elif n > 0:
return ack(m-1, ack(m, n-1))
ack(3, 4)
However, this code can't be used for larger values of m and n.