Project Euler

Problem 2

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

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

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

If you want, you can view this problem at Project Euler instead.

What You Should Do on Your Own

Assignments turned in without these things will not receive any points.

  1. After your program is done and working, add a comment at the top containing the final answer. If your program does not produce the correct answer in a reasonable amount of time, you will not receive points for this assignment.

Frequently-Asked Questions

"Project Euler"? What's up with that?
Project Euler is a site of challenging math-based problems. The easiest problems (like this one!) have been solved by more than 100,000 people. The most difficult (ex: The Silver Dollar Game) have been solved by only about one hundred people worldwide.
How do I know if my solution is correct?
The easiest way is to create an account on the Project Euler website. Then you can check your answers and keep track of your progress.
There are hundreds of Project Euler problems but you only have a few in the assignment list. Will I get points for solving the others?
Of course. When you turn in a correct solution I will determine a fair number of points for it.
How many Project Euler problems have you solved, Mr. Mitchell?
As of November 2012 I have solved 47 problems (1-45, 48 & 67). That puts me in the top 9% of participants on the site.


©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License