This commit is contained in:
gnieark 2015-11-14 21:37:46 +01:00
commit a6d766562c
2 changed files with 32 additions and 0 deletions

13
euler1.php Normal file
View File

@ -0,0 +1,13 @@
<?php
/*
* Gnieark's anwser to euler problem 1
* https://projecteuler.net/problem=1
*/
$sum=0;
for ($i=2;$i<1000;$i++){
if((fmod($i,3)==0) OR (fmod($i,5)==0)){
$sum=$sum+$i;
}
}
echo $sum;

19
euler2.php Normal file
View File

@ -0,0 +1,19 @@
<?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;