Sha256: eef1d0a7edcf5be3899b7c380a538c9c629b31aacaefd0a142e83f54e0cf3a2f
Contents?: true
Size: 513 Bytes
Versions: 4
Compression:
Stored size: 513 Bytes
Contents
# coding: utf-8 class Integer # A deficient number is a number n for which σ(n) < 2n. That is, the sum of # its divisors are less than the number. (To calculate the sum of divisors # for an arbitrary integer see Integer#σ). # # Returns true if the number is deficient; false otherwise. # # 8.deficient? #=> true # 27.deficient? #=> true # 6.deficient? #=> false # def deficient? return false unless self > 0 σ < (2 * self) end alias :defective? :deficient? end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
numb-0.72.1 | lib/numb/deficient.rb |
numb-0.72.0 | lib/numb/deficient.rb |
numb-0.68.0 | lib/numb/deficient.rb |
numb-0.63.0 | lib/numb/deficient.rb |