Skip to content

Instantly share code, notes, and snippets.

@bmeurer
Created February 15, 2017 05:53
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 bmeurer/34d28bb0e391f469eb58e1a06c193321 to your computer and use it in GitHub Desktop.
Save bmeurer/34d28bb0e391f469eb58e1a06c193321 to your computer and use it in GitHub Desktop.
function fibonacci(num){
var a = 1, b = 0, temp;
while (num >= 0){
temp = a;
a = a + b;
b = temp;
--num;
}
return b;
}
let sum = 0;
for (let i = 0; i < 200; ++i) {
sum += fibonacci(i);
}
console.log(sum);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment