Sha256: fa1e7991b9d7dfa4cd814291cc7e7f47c1711d6c0de2477e0236faac075380af
Contents?: true
Size: 406 Bytes
Versions: 36
Compression:
Stored size: 406 Bytes
Contents
# coding: utf-8 class Integer # A frugal number has more digits than the number of digits in its prime # factorization (including exponents). # # Returns true if self is frugal; false otherwise. # # 128.frugal? #=> true # 256.frugal? #=> true # 300.frugal? #=> false # def frugal? digits.size > prime_division.flatten.reject{|d|d==1}.join.to_i.digits.size end end
Version data entries
36 entries across 36 versions & 1 rubygems