Sha256: 1ff3989a53db9554e7d45763a9d2093b07557977866dc1394cfafe9e228e34dd

Contents?: true

Size: 233 Bytes

Versions: 4

Compression:

Stored size: 233 Bytes

Contents

class Integer
  def palindrome?
    reverse == self
  end

  def lychrel?
    n = self
    # This limit is as arbitrary as it looks
    100.times do
      return false if n.palindrome?
      n += n.reverse
    end
    true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
numb-0.152.0 lib/numb/lychrel.rb
numb-0.138.0 lib/numb/lychrel.rb
numb-0.125.0 lib/numb/lychrel.rb
numb-0.114.0 lib/numb/lychrel.rb