Sha256: e050af8f64bb9bfa3a2dac0c076e7af73de95242bcec9e5696bd5c07773a32e1

Contents?: true

Size: 227 Bytes

Versions: 36

Compression:

Stored size: 227 Bytes

Contents

# coding: utf-8
class Integer
  def polydivisible?
    return true if self == 1
    return false if digits.first == 0
    1.upto(digits.size).all? do |first|
      (digits.first(first).join.to_i % first) == 0
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
numb-0.186.0 lib/numb/polydivisible.rb
numb-0.185.0 lib/numb/polydivisible.rb
numb-0.184.0 lib/numb/polydivisible.rb
numb-0.181.0 lib/numb/polydivisible.rb
numb-0.170.0 lib/numb/polydivisible.rb
numb-0.152.0 lib/numb/polydivisible.rb
numb-0.138.0 lib/numb/polydivisible.rb
numb-0.125.0 lib/numb/polydivisible.rb
numb-0.114.0 lib/numb/polydivisible.rb
numb-0.111.0 lib/numb/polydivisible.rb
numb-0.109.0 lib/numb/polydivisible.rb
numb-0.99.0 lib/numb/polydivisible.rb
numb-0.96.0 lib/numb/polydivisible.rb
numb-0.89.0 lib/numb/polydivisible.rb
numb-0.84.0 lib/numb/polydivisible.rb
numb-0.77.0 lib/numb/polydivisible.rb
numb-0.72.1 lib/numb/polydivisible.rb
numb-0.72.0 lib/numb/polydivisible.rb
numb-0.68.0 lib/numb/polydivisible.rb
numb-0.63.0 lib/numb/polydivisible.rb