Project Euler Problem Two

Development 30 May 2010 | 2 Comments

Yesterday I posted my first euler-code. This time we will take a look at problem two, again with the help of some javascript running on node.js.

The problem is “Find the sum of all the even-valued terms in the [fibonacci] sequence which do not exceed four million.”

My take on the solution was to run through all fibonacci numbers below 4.000.000 and adding them to the total, if they were equal. The next fibonacci number is calculated by always saving the last two numbers found.

You will need node.js to run this code.

Tagged in , , , ,

2 Responses on “Project Euler Problem Two”

  1. Hey, good job !

    my approach in javascript here: http://gist.github.com/499293
    with nodejs btw :)

  2. Claus Witt says:

    Thanks for your comment.

    Definitely a more elegant solution than mine. (My idea was to create it as readable for non-dev’s as possible) …

    best regards

    Cw

Leave a Reply