diff --git a/_functions.php b/_functions.php index 2832c67..1208c9e 100644 --- a/_functions.php +++ b/_functions.php @@ -57,5 +57,13 @@ function getAllDivisors($n,$takeOne=true,$takeHimself=true){ } } } + sort($divisors); return $divisors; +} + +function isAbundant($n){ + if(array_sum(getAllDivisors($n,true,false))>$n) + return true; + else + return false; } \ No newline at end of file diff --git a/euler23.php b/euler23.php new file mode 100644 index 0000000..cbedd34 --- /dev/null +++ b/euler23.php @@ -0,0 +1,36 @@ + 28123){ + break; + } + $listOfSumOfAbundants[$somme]=true; + } +} +$sum=0; +for($i=0; $i <= 28123; $i++){ + if(!isset($listOfSumOfAbundants[$i])){ + $sum +=$i; + } +} + +echo $sum; \ No newline at end of file