Skip to content

Instantly share code, notes, and snippets.

@notmarkmiranda
Created November 28, 2015 02:56
Show Gist options
  • Save notmarkmiranda/e1730da1a3be95714631 to your computer and use it in GitHub Desktop.
Save notmarkmiranda/e1730da1a3be95714631 to your computer and use it in GitHub Desktop.
Euler - 002.rb
current = 1
previous = 0
sum = 0
new = 0
while new <= 4000000 do
new = current + previous
if (new % 2 == 0)
sum += new
end
previous = current
current = new
end
puts sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment