in reply to Re: (Golf) Kaprekar's Process
in thread (Golf) Kaprekar's Process
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.
For example, 247:
1: 742-247 = 495
the answer is 1.
your code produces 2.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: (Golf) Kaprekar's Process
by tachyon (Chancellor) on Jun 18, 2001 at 03:19 UTC |
In Section
Meditations