Guest User

Prob2

a guest
Apr 18th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. var x = function(n){
  2. if (n<2){
  3. return 1;
  4. }else{
  5. return x(n-1) + x(n-2);
  6. }
  7. }
  8.  
  9. var total = 0;
  10. var n = 0;
  11. for (n=0;;n++){
  12. if (x(n)<4000000){
  13. if(x(n)%2==0){
  14. total += x(n);
  15. }
  16. }else{
  17. break
  18. }
  19. }
  20. console.log(total);
Advertisement
Add Comment
Please, Sign In to add comment