add function getDivisors
This commit is contained in:
parent
a3d08a1584
commit
fba017bff1
|
@ -38,4 +38,14 @@ function getPrimeNumber($order){
|
|||
$i=$i+2;//sert à rien de tester les nombres pairs
|
||||
}
|
||||
return $i-2;
|
||||
}
|
||||
function getAllDivisors($n){
|
||||
$divisors=array(1);
|
||||
for($i=2;$i<=sqrt($n);$i++){
|
||||
if(fmod($n,$i)==0){
|
||||
$divisors[]=$i;
|
||||
$divisors[]=$n/$i;
|
||||
}
|
||||
}
|
||||
return $divisors;
|
||||
}
|
Loading…
Reference in New Issue
Block a user