Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var x = function(n){
- if (n<2){
- return 1;
- }else{
- return x(n-1) + x(n-2);
- }
- }
- var total = 0;
- var n = 0;
- for (n=0;;n++){
- if (x(n)<4000000){
- if(x(n)%2==0){
- total += x(n);
- }
- }else{
- break
- }
- }
- console.log(total);
Advertisement
Add Comment
Please, Sign In to add comment