Tripped across Kaprekar's number this morning, something maybe I've seen before and forgot: it's a nice convergent property of almost* all four digit base 10 number where sorting the number from high to low digits and then subtracting a low to high sort from it, iteratively, converges quickly to a stable value of 6174.

*Doesn't work four four-digit rep strings like 1111, 2222, etc; they immediately reach 0 instead.

en.wikipedia.org/wiki/6174_(nu

This is one of those simultaneously lovely and probably entirely useless accidents of mathematics; I don't know if anyone has ever done anything with this besides (a) dig in in other bases and digit sizes and (b) found it lovely. I am immediately doing both; apparently for three digit base 10 numbers, 495 is the interesting Kaprekar constant (and 0 is again the boring one for rep digit strings). What about two digit base 10 though? Well, you can just try it!

And maybe you should try it, because (a) there's not that many two digit numbers to begin with and (b) if there IS a Kaprekar constant to be found you'd probably get there quite quickly, much faster than testing all 100 possibilities (or all 90 if we rule out rep digits from the get go).

I gave it a go and within about a minute found myself going...ah! Hmm. Hmm.

The answer became quickly clear to me that there isn't a Kaprekar constant for 2 digit base 10: what there is what you could call a Kaprekar cycle, where the set of five numbers 63, 27, 45, 09, and 81 create a fixed loop that you can't escape from.

And while I have only tested a small handful of starting two digit numbers, I'm convinced already that every 2 digit number will lead either to this cycle of five numbers or to boring old zero for the rep digits.

Why that is is interesting!

Basically, every two-digit number put through the Kaprekar routine yields a multiple of 9. e.g. 14 -> 41-14 = 27. 83-38 = 45. Etc. You can convince yourself of this pretty quickly with a little scribbling.

But, oh, there's only five numbers in the Kaprekar cycle, and there's 10 non-rep multiples of nine in the two digit space. What if something leads to, say, 36? Well, 63-36 = 27 and we're right back in the loop. In fact, all five non-loop multiples lead straight to loop numbers.

And that, too, is very nice when you look closer at it: the five non-loop multiples of nines are, in fact, just the reversed digits of the nine loop multiples. 27 and 72 both yield the same Kaprekar computation of 72-27 = 45.

And because EVERY 2-digit number will lead immediately to a multiple of nine (heck, this is true even for our boring 0 results, since 9*0 = 0), that means we'll get into the cycle within at MOST two steps.

Kaprekar makes efficient, if loopy, work of this digit space.

Visiting MIL, doing some literal back of the envelope calculations while they’re discussing a textile project. Wanted to see the three digit 495 result myself, and then see what emerged for five digits, which is…a loop! I haven’t read up any more on Kaprekar results yet though I saw at a glance that this and a lot of other results have already been mapped out.

In that No Spoilers context, one question I’m curious about: whether there can be multiple distinct constants and/or loops for a given base and digit count. Is this 63954…four-cycle by definition THE answer for non-rep 5 digits, or could it be multi-modal? (Ignoring 0 as always as boring.)

Follow

Mapped out all the two digit transitions into the 5-cycle. Neat little features of the distribution of states; 3+ digits will introduce some more complicated issues it seems like in how to group classes of equivalent numbers together but I think there’s some hints here at the sort of shape of those equivalence classes.

· · Web · 1 · 0 · 3

@joshmillard there has to be rad graphs of this somewhere like they do with the hailstone sequence

Sign in to participate in the conversation
Mastodon

The original server operated by the Mastodon gGmbH non-profit