Euler/euler2.php
2015-11-14 21:37:46 +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;