Skip to content

Instantly share code, notes, and snippets.

@AlexVPopov
Last active December 20, 2015 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexVPopov/6139117 to your computer and use it in GitHub Desktop.
Save AlexVPopov/6139117 to your computer and use it in GitHub Desktop.
Project Euler 2
fib1 = 1
fib2 = 2
sum = fib2
fib = 0
until (fib >= 4000000)
fib = fib1 + fib2
fib1 = fib2
fib2 = fib
sum += fib if fib.even?
end
puts sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment