in reply to (Golf) Kaprekar's Process
I make your original 79 chars.
sub a { return$i if$_[0]==495;$a=join'',sort{$a<=>$b}split//,pop;$i++;a((rever +se$a)-$a) #23456789_123456789_123456789_123456789_123456789_123456789_123456789_ +123456789 }
if you are sorting single digits then perl's default alphanumeric sort will give the same result as explicitly defining a numeric sort. #71
update: just realised you can use $_ instead of $a. #69
"Argument is futile - you will be ignorralated!"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: (Golf) Kaprekar's Process
by srawls (Friar) on Jun 16, 2001 at 23:07 UTC | |
by MeowChow (Vicar) on Jun 16, 2001 at 23:18 UTC | |
by mr.nick (Chaplain) on Jun 17, 2001 at 03:35 UTC |