Permalink
Browse files

Abundant, perfect, and deficient definitions

  • Loading branch information...
1 parent 747af7f commit 04dee5c49edb3c39ae01006baf40f9b19a728213 @stouset committed Jul 20, 2011
Showing with 18 additions and 0 deletions.
  1. +3 −0 lib/euler.rb
  2. +5 −0 lib/integer/abundant.rb
  3. +5 −0 lib/integer/deficient.rb
  4. +5 −0 lib/integer/perfect.rb
View
@@ -7,10 +7,12 @@
require 'enumerable/combination'
require 'enumerable/multiply'
require 'enumerable/sum'
+require 'integer/abundant'
require 'integer/aliquot_sum'
require 'integer/amicable_pair'
require 'integer/choose'
require 'integer/collatz'
+require 'integer/deficient'
require 'integer/digits'
require 'integer/divisible'
require 'integer/divisors'
@@ -19,6 +21,7 @@
require 'integer/factorize'
require 'integer/factors'
require 'integer/palindrome'
+require 'integer/perfect'
require 'integer/proper_divisors'
require 'integer/split'
require 'integer/sigma'
View
@@ -0,0 +1,5 @@
+class Integer
+ def abundant?
+ self < self.aliquot_sum
+ end
+end
View
@@ -0,0 +1,5 @@
+class Integer
+ def deficient?
+ self > self.aliquot_sum
+ end
+end
View
@@ -0,0 +1,5 @@
+class Integer
+ def perfect?
+ self == self.aliquot_sum
+ end
+end

0 comments on commit 04dee5c

Please sign in to comment.