in reply to Re: (Golf) Kaprekar's Process
in thread (Golf) Kaprekar's Process

Humm, I just counted manually and you're right, it is 79. I wonder why this prints 60:
print length("return$i if$_[0]==495;$a=join'',sort{$a<=>$b}" ."split//,pop;$i++;a((reverse$a)-$a)");
Anyway, nice improvements, I should've caught that sort one : )

Update:Ooops, thanks MeowChow.

The 15 year old, freshman programmer,
Stephen Rawls

Replies are listed 'Best First'.
Re: Re: Re: (Golf) Kaprekar's Process
by MeowChow (Vicar) on Jun 16, 2001 at 23:18 UTC
    You're double-quoting the code, which means that the variables are getting interpolated into undef 0-length strings.
                   s aamecha.s a..a\u$&owag.print
Re: Re: Re: (Golf) Kaprekar's Process
by mr.nick (Chaplain) on Jun 17, 2001 at 03:35 UTC
    And I can take it down a litter further massaging your code into this:
    sub g{ # 1 2 3 4 5 6 + 7 # 12345678901234567890123456789012345678901234567890123456789012345678 +9012 return$,if($_=pop)==495;$_=join'',sort split//,$_;$,++;g((reverse)-$ +_) }
    But I can't do one on my own... my own solution came in at 83 :(

    mr.nick ...