Euler/euler02.php
2015-11-15 11:18:16 +01:00

19 lines
228 B
PHP

<?php
/*
* Gnieark's anwser to euler problem 2
* https://projecteuler.net/problem=2
*/
$i=1;
$j=2;
$sum=0;
while($i<4000000){
if(fmod($j,2)==0){
$sum+=$j;
}
$new=$i+$j;
$i=$j;
$j=$new;
}
echo $sum;