Skip to content

Instantly share code, notes, and snippets.

@wulab
Last active August 29, 2015 14:08
Show Gist options
  • Save wulab/98e83808a9b2960a9a1f to your computer and use it in GitHub Desktop.
Save wulab/98e83808a9b2960a9a1f to your computer and use it in GitHub Desktop.
require 'prime'
class Raindrops
def self.convert(number)
factors = number.prime_division.to_h.keys & [3, 5, 7]
return number.to_s if factors.empty?
factors.join.tr('357', 'iao').gsub(/(\w)/, 'Pl\1ng')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment