Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: (Golf) Kaprekar's Process

by tachyon (Chancellor)
on Jun 17, 2001 at 10:54 UTC ( [id://89143] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub a {
      ++$a;$_=join"",sort pop=~/./g;$_!=459?a(-$_+reverse):$a
    }
    
  2. or download this
    sub a {
      ++$a;($_=join"",sort pop=~/./g)!=459?a(-$_+reverse):$a
    }