Sha256: a765b9d4f154c370ac1f052180cf3f31363001d713261cbbd35db347880ff1c9

Contents?: true

Size: 204 Bytes

Versions: 36

Compression:

Stored size: 204 Bytes

Contents

# coding: utf-8
class Integer
  def kynea?
    return true if self == 7
    a, b = to_s(2).match(/^(10+)(1+)$/).to_a[1..-1]
    return false if (a.nil? or b.nil?)
    a.length == (b.length - 1)
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

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