Skip to content

Instantly share code, notes, and snippets.

@saxbophone
Created July 31, 2015 01:32
Show Gist options
  • Select an option

  • Save saxbophone/54be375dd33607ab2bb5 to your computer and use it in GitHub Desktop.

Select an option

Save saxbophone/54be375dd33607ab2bb5 to your computer and use it in GitHub Desktop.
Having some fun with Python Generators...
def fibonacci(a=0, b=1):
yield a
yield b
while True:
a = a+b
yield a
b = b+a
yield b
def fibo_hash(m, a=0, b=1):
for f in fibonacci(a=a, b=b):
if f.bit_length() >= m:
return '%x' % f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment