The Fibonacci sequence is present throughout the natural world. Most programmers are familiar with the sequence which starts 0,1,1,2,3,5,8,13 and continues to any given upper limit. Each new term in the Fibonacci sequence is generated by adding the previous two terms. In this kata we would like you to create a calculator that will return the sum of all the even numbers from a Fibonacci sequence of a given length. So, for length 7 the result would be 10 which is (2 + 8).
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
The interface to your even Fibonacci calculator can be anything you like but we’d suggest passing in a single integer to represent the length to begin with. Feel free to use any language, and write the tests in any order you prefer.
Credits: project euler http://projecteuler.net/problem=2