Sha256: 49ada3622318a9f8dc8f71d2929e58606dfaced3af1113acc63cda3910705179

Contents?: true

Size: 283 Bytes

Versions: 14

Compression:

Stored size: 283 Bytes

Contents

class Integer
  def highly_composite?
    return false if self > 6 and not (abundant? or primorial_product?)
    return true if [1,4,36].include?(self)
    n_divisors = number_of_divisors
    (self-1).downto(1).none? do |x|
      x.number_of_divisors >= n_divisors
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
numb-0.138.0 lib/numb/highly_composite.rb
numb-0.125.0 lib/numb/highly_composite.rb
numb-0.114.0 lib/numb/highly_composite.rb
numb-0.111.0 lib/numb/highly_composite.rb
numb-0.109.0 lib/numb/highly_composite.rb
numb-0.99.0 lib/numb/highly_composite.rb
numb-0.96.0 lib/numb/highly_composite.rb
numb-0.89.0 lib/numb/highly_composite.rb
numb-0.84.0 lib/numb/highly_composite.rb
numb-0.77.0 lib/numb/highly_composite.rb
numb-0.72.1 lib/numb/highly_composite.rb
numb-0.72.0 lib/numb/highly_composite.rb
numb-0.68.0 lib/numb/highly_composite.rb
numb-0.63.0 lib/numb/highly_composite.rb