Skip to content

Instantly share code, notes, and snippets.

@fulmicoton
Created July 2, 2014 08:57
Show Gist options
  • Save fulmicoton/853f97fb6d8bb9560b46 to your computer and use it in GitHub Desktop.
Save fulmicoton/853f97fb6d8bb9560b46 to your computer and use it in GitHub Desktop.
def fibo_dynamic(n):
cur = 0 # F_i
next = 1 # F_i+1
while True:
yield cur
(cur, next) = (next, cur+next)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment