This commit is contained in:
gnieark 2015-11-15 22:57:22 +01:00
parent 513f500b22
commit e8c94739fa

View File

@ -3,22 +3,5 @@
* Gnieark's anwser to euler problem 6
* https://projecteuler.net/problem=6
*/
$primesNumbers=array(2);//ommit 1
$i=3;
while(count($primesNumbers)<10001){
$isPrimaryNumber=true;
$index=0;
while(($primesNumbers[$index]<=sqrt($i)) && $index < count($primesNumbers)){
if(fmod($i,$primesNumbers[$index])==0){
$isPrimaryNumber=false;
break;
}
$index++;
}
if($isPrimaryNumber){
$primesNumbers[]=$i;
echo (count($primesNumbers))." ".$i."\n";
}
$i=$i+2;
}
require_once("_functions.php");
echo getPrimeNumber(10001);