Skip to content

Instantly share code, notes, and snippets.

@saleph
Created July 22, 2015 17:51
Show Gist options
  • Save saleph/232bf1a3cd3df3a392db to your computer and use it in GitHub Desktop.
Save saleph/232bf1a3cd3df3a392db to your computer and use it in GitHub Desktop.
recursive fib sequence
__author__ = "tom"
def fib(n):
if n == 1:
return 1
if n == 2:
return 1
return fib(n-1) + fib(n-2)
print([fib(x) for x in range(1, 30)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment