Just another Perl shrine | |
PerlMonks |
Re: Re: (Golf) Kaprekar's Processby sean (Beadle) |
on Jun 17, 2001 at 21:38 UTC ( [id://89179]=note: print w/replies, xml ) | Need Help?? |
This doesn't work for a lot of numbers, because you're checking AFTER the sort, for 459, which could've been 459,495,954,945,549, or 594 before the sort. your code gets the right answer when it was anything EXCEPT 495 before the sort. For example, 247: 1: 742-247 = 495 the answer is 1. your code produces 2.
In Section
Meditations
|
|