# Ode to convergence

  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?

## 2 Answers

You're referring to:

Kaprekar's routine

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.

• Everything you say, is of course true, and very much intended. There are a couple of other things I'd really like to see: one is essential for explaining the second line of the poem, and the other one is crucial for saving my reputation as a poet.
– Bass
Mar 19, 2018 at 13:18
• For the second line... is quad referring to a quadruple or quad tuple, to reference the 4 digits? Mar 19, 2018 at 13:21
• I'm not sure if I understand your question, but to remove any ambiguity, the intended meaning of "non-quad four" is "any 4 digits that wouldn't beat a full house as a poker hand" :-)
– Bass
Mar 19, 2018 at 13:31

Building on Phylyp's answer :

All 4 digits numbers except quadruples lead to Kaprekar's constant 6174 when we apply the algorithm described.
Note that each line of the riddle shows words of respectively 6, 1, 7, and 4 letters, reminding us of the fix-point of the algorithm, which makes for the beauty of the riddle.

• Beauty, indeed :-) (and yes, these were exactly the things I meant in my comment to @Phylyp 's answer.)
– Bass
Mar 19, 2018 at 14:35
• Nice - I didn't see the 6-1-7-4 pattern in the verse :-) Mar 19, 2018 at 14:50