Sha256: 249cec69c3fb8e25b567770e267862233c2d9d0e177d6254dc8d7e783b73a479
Contents?: true
Size: 285 Bytes
Versions: 6
Compression:
Stored size: 285 Bytes
Contents
# coding: utf-8 class Integer def nsw case self when 0 then 1 when 1 then 7 else 6 * (self - 1).nsw - (self - 2).nsw end end memoize(:nsw) def nsw? m = self (rhs = (m**2).succ).divides?(2) and 2 * ((rhs/2).isqrt**2) == rhs end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
numb-0.186.0 | lib/numb/nsw.rb |
numb-0.185.0 | lib/numb/nsw.rb |
numb-0.184.0 | lib/numb/nsw.rb |
numb-0.181.0 | lib/numb/nsw.rb |
numb-0.170.0 | lib/numb/nsw.rb |
numb-0.152.0 | lib/numb/nsw.rb |