protected function isPerfectNumber($number)
    {
        $d = 0;
        $max = \sqrt($number);
        for ($n = 2; $n <= $max; ++$n) {
            if (!($number % $n)) {
                $d += $n;
                if ($number / $n !== $n) {
                    $d += $number / $n;
                }
            }
        }

        return ++$d === $number;
    }