lib/numb/perfect.rb in numb-0.21.0 vs lib/numb/perfect.rb in numb-0.63.0
- old
+ new
@@ -1,10 +1,8 @@
# coding: utf-8
class Integer
def perfect?
return false if self < 6 or self.odd? or self.to_s !~ /(6|8)$/
return false if self != 6 and digital_root != 1
- divisors = proper_positive_divisors
- return false unless (divisors.size + 1).even?
- divisors.reduce(:+) == self
+ k_perfect?(2)
end
end