Sha256: e63944c76206036514d01632f12f5b370bc1c5206a1d8d02665776f0512ce280

Contents?: true

Size: 360 Bytes

Versions: 36

Compression:

Stored size: 360 Bytes

Contents

# coding: utf-8
class Integer
  # A factorion is a number equal to the sum of the factorials of its decimal
  # digits.
  #
  # Returns true if self is a factorion; false otherwise.
  #
  #     145.factorion?    #=> true
  #     40585.factorion?  #=> true
  #     200.factorion?    #=> false
  #
  def factorion?
    [1, 2, 145, 40585].include? self
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

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