Sha256: 05a425c664131342e3e9c1733e1dc8c32e5560bfaec140e7cbb9f3a6d2f7b276
Contents?: true
Size: 300 Bytes
Versions: 16
Compression:
Stored size: 300 Bytes
Contents
# coding: utf-8 class Integer def parasitic?(n=nil) return (1..9).any?{|x| parasitic?(x)} if n.nil? return true if (n == 1 && self == 1) return false unless self > 9 raise ArgumentError unless (n.positive? && n < 10) (n*self) == [digits.last, digits[0..-2]].join.to_i end end
Version data entries
16 entries across 16 versions & 1 rubygems