Last active
October 29, 2022 20:17
-
-
Save wilhelmklopp/c4202dba0d6006586e9d752782375695 to your computer and use it in GitHub Desktop.
kolo run demo. run with `kolo run python fib.py`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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