Skip to content

Instantly share code, notes, and snippets.

@jakedobkin
Created November 28, 2011 01:31
Show Gist options
  • Select an option

  • Save jakedobkin/1398715 to your computer and use it in GitHub Desktop.

Select an option

Save jakedobkin/1398715 to your computer and use it in GitHub Desktop.
Euler 25
# set initial terms in fib sequence
a = 1
b = 1
c = 0
string = ""
count = 3
# generate fib sequence until you get a number with 1000 digits
while (len(string) <= 1000):
c = a + b
a = b
b = c
string = str(c)
length = len(string)
if (length == 1000):
print "fib number %d has %d digits" % (count, length)
count = count + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment