Created
September 26, 2012 21:32
-
-
Save kpassapk/3790722 to your computer and use it in GitHub Desktop.
Euler2 Slightly Less Naive
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
MAX = 1e7 | |
f0 = 1 | |
f1 = 2 | |
sum = 2 | |
begin | |
f = f0 + f1 | |
f0 = f1 | |
f1 = f | |
break if f > MAX | |
if f % 2 == 0 | |
sum = sum + f | |
end | |
end while true | |
puts sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment