From fd45b77ba8672675668978aebe7772dc2839a5e7 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Sat, 21 Nov 2015 14:50:14 +0100 Subject: [PATCH] options --- _functions.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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;