Taking a numeral core
(digits: a non-quad four)
digits I ordered, then
lesser I minused, till
evolve I couldn't more.
What is this unfathomably clunky poem all about?
Answer
You're referring to:
Quoting from the linked Wikipedia article:
Kaprekar's routine is an algorithm in recreational mathematics which produces a sequence of numbers which either converges to a constant value or results in a repeating cycle. The algorithm is as follows:1. Choose any natural number n in some base (usually base 10). This is the first number of the sequence.
2. Create a new number n′ by arranging the digits of n in descending order, and another new number n″ by arranging the digits of n in ascending order.
3. These numbers may have leading zeros, which can be discarded (or alternatively, retained). Subtract n′ − n″ to produce the next number of the sequence.
4. Repeat step 2.For example, if we start with 3524 then we get:
5432 − 2345 = 3087 8730 − 378 = 8352 8532 − 2358 = 6174 7641 − 1467 = 6174
A few more points:
- The title refers to the convergence of the number as one of the exit conditions
- The riddle is written in like an algorithm, with the two indented lines representing a loop that is initialized with the line preceding it, and the exit criteria as the line that follows it
And a credit to Florian Bourse's answer for these points:
- Kaprekar's constant is 6174, and each line in the verse consists of words of length 6, 1, 7 and 4.
- The only numbers which when subject to Kaprekar's routine don't converge at 6174 are numbers composed of the same digit (e.g. 1111).
- This ties in to Bass's comment about the poker hand.
No comments:
Post a Comment