Sha256: e9cd19ac8928256e1ece7352c48899c12ed67c11a303e0c93ca44868863d5b4a
Contents?: true
Size: 535 Bytes
Versions: 4
Compression:
Stored size: 535 Bytes
Contents
# coding: utf-8 class Integer # An abundant number is a number n for which σ(n) > 2n. That is, the sum of # its divisors exceeds 2n. (See Integer#σ to compute the sum of the divisors # of an arbitrary integer). # # Returns true if the number is abundant; false otherwise. Aliased to # Integer#excessive?. # # 96.abundant? #=> true # 100.abundant? #=> true # 345.abundant? #=> false # def abundant? return false unless self > 0 σ > (2 * self) end alias :excessive? :abundant? end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
numb-0.72.1 | lib/numb/abundant.rb |
numb-0.72.0 | lib/numb/abundant.rb |
numb-0.68.0 | lib/numb/abundant.rb |
numb-0.63.0 | lib/numb/abundant.rb |