Skip to content

Instantly share code, notes, and snippets.

@szaboat
Created April 29, 2010 08:27
Show Gist options
  • Save szaboat/383320 to your computer and use it in GitHub Desktop.
Save szaboat/383320 to your computer and use it in GitHub Desktop.
(function(){
var i = 2, sum = 0, limit = 4000000;
do {
var f = fib(i);
(f%2==0)?sum+=f:'';
i++;
} while (fib(i) < limit)
print(sum);
function fib(n){
return n<2?n:fib(n-1)+fib(n-2);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment