Skip to content

Instantly share code, notes, and snippets.

@gkucmierz
Created February 13, 2019 00:14
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 gkucmierz/5f6ee4a23bc990c1ea1a6cb13b9f3529 to your computer and use it in GitHub Desktop.
Save gkucmierz/5f6ee4a23bc990c1ea1a6cb13b9f3529 to your computer and use it in GitHub Desktop.
let f = [1, 1];
let sum = 0;
while(f[0] < 4e6){
f.push(f[0]+f[1]);
let e = f.shift();
sum += e % 2 === 0 ? e : 0;
}
console.log(sum);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment