Sha256: 7e2d41b23d970561f612abedccb05498e3caa09ef914882ec9451278ab44c5c7
Contents?: true
Size: 514 Bytes
Versions: 11
Compression:
Stored size: 514 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 positive? σ < (2 * self) end alias :defective? :deficient? end
Version data entries
11 entries across 11 versions & 1 rubygems