Created
May 3, 2015 03:55
-
-
Save sheniff/9a961889268ff78ff603 to your computer and use it in GitHub Desktop.
Spoiler Alert: Project Euler 2
This file contains hidden or 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
| var sum = 2, | |
| prev = 1, | |
| prev2 = 2, | |
| curr; | |
| while ((curr = prev + prev2) < 4000000) { | |
| prev = prev2; | |
| prev2 = curr; | |
| !(curr % 2) && (sum += curr); | |
| } | |
| console.log(sum); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment