<?xml version="1.0" encoding="windows-1252"?>
<node id="89106" title="Re: Re: Re: (Golf) Kaprekar's Process" created="2001-06-16 21:47:29" updated="2005-07-21 01:27:21">
<type id="11">
note</type>
<author id="17251">
MeowChow</author>
<data>
<field name="doctext">
Verrrry cool idea... this can actually come down to 56:
&lt;code&gt;
sub k {
   $_="000"|"@_";/495/?0:1+k(-($_=join'',sort/./g)+reverse)
}
&lt;/code&gt;
The interesting thing about this is that it's not the same as right-formatting the number via [sprintf], since the 0 goes to the back, but it doesn't matter because the digits are reordered anyway.
&lt;pre&gt;
  &lt;a href="/index.pl?node=MeowChow"&gt; MeowChow                                   &lt;/a&gt;
               s aamecha.s a..a\u$&amp;owag.print&lt;/pre&gt;</field>
<field name="root_node">
89075</field>
<field name="parent_node">
89100</field>
</data>
</node>
