This commit is contained in:
Gnieark 2015-11-21 14:50:14 +01:00
parent dcbaa4c2cc
commit fd45b77ba8

View File

@ -40,8 +40,15 @@ function getPrimeNumber($order){
return $i-2; return $i-2;
} }
function getAllDivisors($n){ function getAllDivisors($n,$takeOne=true,$takeHimself=true){
$divisors=array(1); $divisors=array();
if($takeOne){
$divisors[]=1;
}
if($takeHimself){
$divisors[]=$n;
}
for($i=2;$i<=sqrt($n);$i++){ for($i=2;$i<=sqrt($n);$i++){
if(fmod($n,$i)==0){ if(fmod($n,$i)==0){
$divisors[]=$i; $divisors[]=$i;