Skip to content

Instantly share code, notes, and snippets.

@wilhelmklopp
Last active October 29, 2022 20:17
Show Gist options
  • Save wilhelmklopp/c4202dba0d6006586e9d752782375695 to your computer and use it in GitHub Desktop.
Save wilhelmklopp/c4202dba0d6006586e9d752782375695 to your computer and use it in GitHub Desktop.
kolo run demo. run with `kolo run python fib.py`
def fib(n):
if n:
return n == 1 and n or fib(n - 1) + fib(n - 2)
return 0
def A(m, n, s="% s"):
if m == 0:
return n + 1
if n == 0:
return A(m - 1, 1, s)
n2 = A(m, n - 1, s % ("A(% d, %% s)" % (m - 1)))
return A(m - 1, n2, s)
if __name__ == "__main__":
# A(3, 2)
fib(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment