Skip to content

Instantly share code, notes, and snippets.

@johana-star
Created May 27, 2011 17:06
Show Gist options
  • Save johana-star/995698 to your computer and use it in GitHub Desktop.
Save johana-star/995698 to your computer and use it in GitHub Desktop.
Euler Project Problem #025
# Solution to Project Euler's twenty-fifth problem
# http://projecteuler.net/index.php?section=problems&id=10
# Find the term of the first thousand-digit Fibonacci number.
i1, i2, count = 1, 1, 2
until i1.to_s.length == 1000 or i2.to_s.length == 1000
i1 = i1 + i2
i2 = i2 + i1
count += 2
end
if i1.to_s.length == 1000 then puts "#{i1} whose term is #{count-1}"
else puts "#{i2} whose term is #{count}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment