in reply to (Golf) Kaprekar's Process
The answers given thus far all fail on numbers (such as 100 and 211) which generate two-digit numbers in their intermediate results. Here's a good test for this particular golf:
74 68 63 chars:
And here's a correct solution at$| = 1; for (100..999) { next if /(.)\1\1/; print "$_ : ", k($_), $/; }
sub k { $_=sprintf"%03d",pop;/495/?0:1+k(-($_=join'',sort/./g)+reverse) }
MeowChow s aamecha.s a..a\u$&owag.print
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: (Golf) Kaprekar's Process
by Anonymous Monk on Jun 17, 2001 at 00:47 UTC | |
by MeowChow (Vicar) on Jun 17, 2001 at 01:47 UTC | |
by Anonymous Monk on Jun 17, 2001 at 02:49 UTC | |
by srawls (Friar) on Jun 18, 2001 at 05:19 UTC | |
In Section
Meditations