Sha256: cba896d85129ab11bdd9430e05bda41c62535cdd1bbe9cfa06ecbd40fad6381c
Contents?: true
Size: 202 Bytes
Versions: 5
Compression:
Stored size: 202 Bytes
Contents
# coding: utf-8 class Integer def q return 1 if (n = self) <= 2 (n - (n - 1).q).q + (n - (n - 2).q).q end memoize :q def q? (1..(self ** 2)).any?{|n| n.q == self} or nil end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
numb-0.186.0 | lib/numb/q.rb |
numb-0.185.0 | lib/numb/q.rb |
numb-0.184.0 | lib/numb/q.rb |
numb-0.181.0 | lib/numb/q.rb |
numb-0.170.0 | lib/numb/q.rb |