Question:

The cool brain teaser?

by  |  earlier

0 LIKES UnLike

what would be the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million?

 Tags:

   Report

2 ANSWERS


  1. Write a program to generate Fibonacci numbers. The first two terms are 1 and 1. After that, compute each term by adding the previous two together. (Do not use recursion, because that will take forever unless you memoize values). Stop when a term exceeds 4 million, and loop through the smaller values, finding the sum of only the even ones. After you have done all this, you will have the answer. By the way it is about 4600000. I'm not going to give you the exact answer because this question is on Project Euler at

    http://projecteuler.net/index.php?sectio...

    Edit: Why did I get a thumbs-down? What's wrong with my answer? The fact that you have to write a program? This question is posted in Programming & Design! This is exactly the way you're supposed to solve the problem, it's a simple programming exercise.

    Actually, now that I think of it, why should I even care what somebody else thinks? Hmmm...


  2. 1 1 2 3 5 8 13 21 34 55

    there is a pattern.. odd odd even odd odd even.

    wait i dont think the fibbonacci secuence ends..

    lol
You're reading: The cool brain teaser?

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.