A plain-English explainer

The five-digit cousin of 6174

In 1949, an Indian schoolteacher noticed a curious thing about four-digit numbers: a clean routine that always lands on the same answer. It worked at three digits too. At five digits, his rule didn't lead to a single landing spot, and that's been the story for seventy-five years. There's a different question you can ask alongside his. This is what I found when I asked it.

Pick any four-digit number, as long as it has at least two different digits in it. 1729 works. 2024 works. 9876 works. Now do this:

  1. Put the digits in order from biggest to smallest.
  2. Put the same digits in order from smallest to biggest.
  3. Subtract the smaller number from the bigger one.
  4. Do it again with the answer.

Try it with 1729:

9721 − 1279 = 8442
8442 − 2448 = 5994
9954 − 4599 = 5355
5553 − 3555 = 1998
9981 − 1899 = 8082
8820 − 0288 = 8532
8532 − 2358 = 6174

You land on 6174. And then you stay there. 7641 − 1467 = 6174. The number eats its own tail.

Pick any other four-digit number, follow the same steps, and the same thing happens. You land on 6174. Always within seven steps. Always.

This routine was discovered in 1949 by an Indian schoolteacher named D.R. Kaprekar. The number 6174 is sometimes called Kaprekar's constant. The routine is famous because of how clean it is: one simple rule, one number every four-digit input ends up at, and a short proof you can almost do in your head. That's the kind of result mathematicians love. Math teachers have been showing it to kids for seventy-five years.

What about five digits?

Try the same steps with three digits and you always land on 495. Three digits work. Four digits work.

Try it yourself The classic Kaprekar calculator lets you type any 3- or 4-digit number and watch it walk to 495 or 6174, the same way 1729 walked to 6174 above. Type a number. Watch it move. Try another one.

But try the same routine with five digits and there's no constant to land on. You don't reach a fixed number; you bounce around in a small loop forever.

For a long time, that was the end of it. Kaprekar's routine is what it is: it works at three and four digits, and it doesn't reach a single number at five. Different digit lengths just behave differently, and that's the story.

I kept wondering if there was more to say.

Another way of asking the question

Kaprekar's routine uses one specific way to mix up the digits before subtracting: sort them one way, sort them the other way, subtract. That's the rule. It's a really good rule, and a big part of why is that it's so simple. But it's not the only way you could mix the digits. You could shuffle them in lots of other orders before subtracting and still ask the same kind of question: does any starting number always land on the same final number?

How many other shuffles are there?

At three digits, there are 12. At four digits, 216. At five digits, 5,280. At six digits, almost 200,000.

Kaprekar's shuffle is one of them. The classic version. The famous version. The other ones aren't in the spotlight, but they're sitting there in the same family.

So a different question from the classic one is: among all those shuffles, are there any other "land here forever" numbers? And if there are, do any of them keep working as you stretch the routine to longer numbers?

This is the question I kept thinking about. It's not the question Kaprekar was asking. His question was about his one rule, and his answer was complete on its own. This is just a different question, sitting next to his.

Answering it takes more bookkeeping than answering Kaprekar's. To check just the five-digit case you have to test 5,280 different shuffles against 99,540 different starting numbers, follow each one until it either lands somewhere or starts looping, and keep track of all the results. That's about half a billion subtractions. A modern laptop crunches the numbers in seconds. The harder part is making sense of what comes out the other side.

Try it yourself The 60714 calculator lets you watch any number, five digits or twenty, walk to 60714, the same way 1729 walked to 6174 above. Type a number. Watch it move. Try another one.

What turned up

At five digits, there are exactly 33 numbers that act like 6174, each under one of those other shuffles. Land there, and you stay there.

One of the 33 is 60714.

That alone isn't the interesting part. Here's the interesting part: out of those 33 numbers, only one of them keeps working when you stretch the routine to six-digit numbers. Then to seven digits. Then to eight. All the way up.

That one is 60714.

"60714 is the only five-digit number whose Kaprekar-style behavior keeps working at six digits, and seven, and eight, and every digit length above."

The shuffle changes a little each time you add a digit (it has to, to fit the longer number), but there's a clean recipe for how it changes. And that recipe holds up. Not just up to some limit a computer can check, but provably, all the way up. As far as anyone has shown, 60714 is the first number that does this.

So what's it good for?

I'm not going to oversell this. 60714 isn't going to make your phone faster or break any codes. It's a small new fact about how numbers behave when you shuffle their digits in a certain way. That's all.

Even so, I wouldn't say it's good for nothing. Math like this has a long history of being useful in ways nobody saw coming, sometimes years later. Closer to today, the routine has the right shape for a daily online puzzle, a school competition, a classroom example for kids learning about numbers, or a starting point for someone else's project. A few of those ideas are already on my list.

What I'd really say is this. The kind of math that started Kaprekar's work, and the kind that produced 60714, is the kind anyone curious can pick up and play with. Kaprekar himself was a high-school teacher in a small town in India. He wasn't a famous professor. He just kept noticing things and writing them down.

The result here is in the same spirit. It's a small, real fact. You can pick it up and play with it.

What's next

The full paper is online and is being sent to a math archive called arXiv and to a journal that publishes computer-aided math discoveries. The number sequence at the heart of the result has been sent to the Online Encyclopedia of Integer Sequences, which catalogs interesting number patterns. All the code, all the data, and the full record of how the work was done are in the public folder linked below.

If you want to see the routine in action, there's a 60714 calculator that lets you type any number and watch it walk home to 60714. That's how I started. It's how I'd recommend you start too.