Last active
August 29, 2015 13:58
-
-
Save nicholsonjf/10074580 to your computer and use it in GitHub Desktop.
Project Euler #104 notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Below function returns the index of the first number in the | |
# fibonacci sequence where first nine digits contain integers 1-9 | |
def first_nine(): | |
a, b, indexb = 1, 1, 2 | |
nine = set('123456789') | |
b_first_nine = set(str(b)[:9]) | |
while (nine <= b_first_nine) == False: | |
a, b, indexb = b, b + a, indexb + 1 | |
b_first_nine = set(str(b)[:9]) | |
print indexb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment