X Tutup
"""This module contains a code example related to Think Python, 2nd Edition by Allen Downey http://thinkpython2.com Copyright 2015 Allen Downey License: http://creativecommons.org/licenses/by/4.0/ """ from __future__ import print_function, division def ackermann(m, n): """Computes the Ackermann function A(m, n) See http://en.wikipedia.org/wiki/Ackermann_function n, m: non-negative integers """ if m == 0: return n+1 if n == 0: return ackermann(m-1, 1) return ackermann(m-1, ackermann(m, n-1)) print(ackermann(3, 4))
X Tutup