Kaprekar's Constant

Take any four digit number (whose digits are not all identical), and do the following:

Rearrange the string of digits to form the largest and smallest 4-digit numbers possible. Take these two numbers and subtract the smaller number from the larger. Use the number you obtain and repeat the above process. What happens if you repeat the above process over and over? Let's see...
Suppose we choose the number 3141.
The process eventually hits 6174 and then stays there!

But the more amazing thing is this: every four digit number whose digits are not all the same will eventually hit 6174, in at most 7 steps, and then stay there!

Presentation Suggestions:
Remember that if you encounter any numbers with fewer than has fewer 4 digits, it must be treated as though it had 4 digits, using leading zeroes. Example: if you start with 3222 and subtract 2333, then the difference is 0999. The next step would then consider the difference 9990-0999=8991, and so on. You might ask students to investigate what happens for strings of other lengths or in other bases.

The Math Behind the Fact: Each number in the sequence uniquely determines the next number in the sequence. Since there are only finitely many possibilities, eventually the sequence must return to a number it hit before, leading to a cycle. So any starting number will give a sequence that eventually cycles. There can be many cycles; however, for length 4 strings in base 10, there happens to be 1 non-trivial cycle, and it has length 1 (involving the number 6174).

Note by Nurul Ikram
4 years, 7 months ago

No vote yet
1 vote

  Easy Math Editor

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

  • Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
  • Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
  • Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.
  • Stay on topic — we're all here to learn more about math and science, not to hear about your favorite get-rich-quick scheme or current world events.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold

- bulleted
- list

  • bulleted
  • list

1. numbered
2. list

  1. numbered
  2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1

paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
    # 4 spaces, and now they show
    # up as a code block.

    print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in \( ... \) or \[ ... \] to ensure proper formatting.
2 \times 3 2×3 2 \times 3
2^{34} 234 2^{34}
a_{i-1} ai1 a_{i-1}
\frac{2}{3} 23 \frac{2}{3}
\sqrt{2} 2 \sqrt{2}
\sum_{i=1}^3 i=13 \sum_{i=1}^3
\sin \theta sinθ \sin \theta
\boxed{123} 123 \boxed{123}


Sort by:

Top Newest

Can you find an expression which will tell you the number of steps?

(Even I don't know the answer. Just checking if you do.)

Rajdeep Dhingra - 4 years, 7 months ago

Log in to reply

I think your statement needs better clarity. It is not enough that all digits are not identical

For example

  • 99988999=9999998-8999=999
  • 33322333=9993332-2333=999

Sumon Jose - 4 years, 7 months ago

Log in to reply

Can you make the correct statement ?

Rajdeep Dhingra - 4 years, 7 months ago

Log in to reply

read my note on karpekar's contant

Atharva Bagul - 4 years, 7 months ago

Log in to reply

I am sorry I did not get your point. Could you please tell me if there is anything wrong in the way in which I understood the theorem above? In the numbers I gave all digits are not the same. There are three nines and one eight in the first case. And the substraction would give the answer 999. And that would hit a zero in the next iteration.

Sumon Jose - 4 years, 7 months ago

Log in to reply

@Sumon Jose You should add a zero before 999 as stated in the note. Then continue your iterations!

Akhash Raja Raam - 4 years, 7 months ago

Log in to reply

@Akhash Raja Raam correct akhash raja raam

Atharva Bagul - 4 years, 6 months ago

Log in to reply


Problem Loading...

Note Loading...

Set Loading...