Skip to content

Instantly share code, notes, and snippets.

@fulmicoton
Created July 2, 2014 08:58
Show Gist options
  • Save fulmicoton/22ca82527d0cbd031c9d to your computer and use it in GitHub Desktop.
Save fulmicoton/22ca82527d0cbd031c9d 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