diff --git a/_functions.php b/_functions.php index 613f15c..2832c67 100644 --- a/_functions.php +++ b/_functions.php @@ -40,8 +40,15 @@ function getPrimeNumber($order){ return $i-2; } -function getAllDivisors($n){ - $divisors=array(1); +function getAllDivisors($n,$takeOne=true,$takeHimself=true){ + $divisors=array(); + if($takeOne){ + $divisors[]=1; + } + if($takeHimself){ + $divisors[]=$n; + } + for($i=2;$i<=sqrt($n);$i++){ if(fmod($n,$i)==0){ $divisors[]=$i;