bug fix
This commit is contained in:
parent
e8c94739fa
commit
55afed209b
|
@ -23,15 +23,14 @@ function getPrimeNumber($order){
|
|||
|
||||
while (count($primeNumbersList) < $order){
|
||||
$isPrimaryNumber=true;
|
||||
foreach($primeNumbersList as $pr){
|
||||
|
||||
if($pr>sqrt($i)){
|
||||
break;
|
||||
}
|
||||
if(fmod($i,$pr)==0){
|
||||
$index=0;
|
||||
|
||||
while(($primeNumbersList[$index]<=sqrt($i)) && $index < count($primeNumbersList)){
|
||||
if(fmod($i,$primeNumbersList[$index])==0){
|
||||
$isPrimaryNumber=false;
|
||||
break;
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
if($isPrimaryNumber){
|
||||
$primeNumbersList[]=$i;
|
||||
|
|
Loading…
Reference in New Issue
Block a user