Sha256: dd20df12530e79d2da79df69d1d800e130d4955c169de33ee9d3adbd7caf6000
Contents?: true
Size: 327 Bytes
Versions: 11
Compression:
Stored size: 327 Bytes
Contents
class Integer def factorial return 1 if zero? (1..self).reduce(:*) end def factorial? divisors = self.divisors.sort divisors.each_with_index do |d, i| if divisors[i.succ] == d.succ return true if d.factorial == self else return d.factorial == self end end end end
Version data entries
11 entries across 11 versions & 1 rubygems