Skip to content

Instantly share code, notes, and snippets.

@shieldsd
Created March 30, 2012 14:09
Show Gist options
  • Save shieldsd/2251773 to your computer and use it in GitHub Desktop.
Save shieldsd/2251773 to your computer and use it in GitHub Desktop.
Project Euler #25
from itertools import takewhile
def fib():
a, b = 1, 1
while 1:
yield a
a, b = b, a + b
print sum(1 for _ in takewhile(lambda x: len(str(x)) < 1000, fib()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment