Sort, subtract, repeat: four-digit numbers almost always end at 6174

Sort, subtract, repeat: four-digit numbers almost always end at 6174
Image: Intellect (generated)

In short: Choose a four-digit number with at least two different digits, arrange its digits from largest to smallest and then smallest to largest, and subtract. Repeat the step and the sequence reaches 6174 within seven iterations. Indian mathematician D. R. Kaprekar described this routine, and the number it reaches is now called Kaprekar's constant.

Kaprekar's routine is an iterative procedure from number theory. Each round begins with a four-digit number, sorts its digits into descending and ascending order, and takes the difference between the two resulting numbers. That difference becomes the input for the next round. Leading zeros may appear and can simply be ignored. Starting from 3524, the sequence runs 3087, then 8352, then 6174, and 6174 maps back to itself. A number that maps to itself is called a fixed point of the mapping, and 6174 is the fixed point the routine reaches for four-digit numbers in base 10. Any sequence that avoids a fixed point ends in a repeating cycle instead, and in either case the end result arrives after a fairly small number of steps.

Part of the explanation is arithmetic. Rearranging digits leaves the digit sum unchanged, so every number in a sequence shares the same remainder when divided by nine. That restriction narrows the possible values and helps explain why the process settles. The same routine can be run in any natural number base, which gives mathematicians a whole family of related constants to compare. Base 10 has been studied closely. In 1981, G. D. Prichett and colleagues showed that its Kaprekar's constants are limited to two numbers, 495 with three digits and 6174 with four.

More recent work has refined the picture. In 2024, researchers associated with the Ranzan Mathematics Study Group, including Haruo Iwasaki, argued that every Kaprekar number must belong to one of five disjoint sets built from a handful of base numbers, and that this scheme also corrects an overlap in the earlier classification. Earlier, in 2005, Y. Hirata computed the fixed points to 31 decimal digits and studied how they were spread out. Taken together, the work shows how a rule as plain as sorting and subtracting can hide structure that took decades to describe fully.

Opens the Intellect+ feed with this card first. Swipe up for the next one.

Sources

To cite this card, link to https://intellectplus.co.uk/app/science-kaprekar-s-routine.

How we source, check and correct cards: Editorial standards.

General information, not professional advice. Spotted an error? Flag the card or see corrections and complaints.

Intellect Plus is a visual educational discovery platform for exploring fascinating facts and ideas. Brain Food, Not Brain Rot. What is Intellect Plus?

Related

Finding something worth knowing…