From: Dirk Meijer Date: 2006-09-04T22:54:57+09:00 Subject: Re: Happy Numbers (#93) ------=_Part_51472_30684299.1157378088638 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline hi list, my solution isn't short, and it isn't fast, only does base 10 (i didn't feel up to it), and probably isn't very efficient. but it _is_ a solution :-) here is it: ------------------------------------ happynumbers.rb ------------------------------------ class Integer def happy?(show_sum=false) string=self.to_s passed=[self] sum=[] output="" loop do a=0 0.upto(string.length-1) do |v| digit=string[v,1].to_i sum<<"#{digit}^2" if show_sum==true a+=digit * digit end if show_sum==true output<