Question Number
2
Project Euler Question

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.

Solution Found
True

File Status: Solution File found. Code from the function code_solution_2 will be used

Solution: 4613732

Solution Code:

      <?php

  function code_solution_2() {
    $answer = 0;
    $i=1;
    $j=2;

    while($j <= 4000000) {
      if($j % 2 == 0) $answer += $j;
      $temp = $j;
      $j += $i;
      $i = $temp;
    }

    return $answer;
  }