Sha256: e100563c6fa0c0e4223621f3836373b684d611969a7e5c50172c010511e6dc5e

Contents?: true

Size: 536 Bytes

Versions: 11

Compression:

Stored size: 536 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 positive?
    σ > (2 * self)
  end

  alias :excessive? :abundant?
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
numb-0.152.0 lib/numb/abundant.rb
numb-0.138.0 lib/numb/abundant.rb
numb-0.125.0 lib/numb/abundant.rb
numb-0.114.0 lib/numb/abundant.rb
numb-0.111.0 lib/numb/abundant.rb
numb-0.109.0 lib/numb/abundant.rb
numb-0.99.0 lib/numb/abundant.rb
numb-0.96.0 lib/numb/abundant.rb
numb-0.89.0 lib/numb/abundant.rb
numb-0.84.0 lib/numb/abundant.rb
numb-0.77.0 lib/numb/abundant.rb