TikTok is often the source for life advice like “how to accidentally inhale gas banned by the Geneva Convention” and “how to ruin a bunch of scientific studies.” He has also discovered number theory.

Math Letters posted a Tuesday video in which he showed off the unique property of the number 495, which he calls the three-digit Kaprekar constant.

The Kaprekar routine is a mathematical method that shows how any number of three digits can be used. However, you cannot choose all three numbers to be the same so there won’t be any 111, 222, or similar. Finally, it will end up at 495.

You just need to change the order of the digits, from the largest to the smallest, and then reverse the process to take the difference. Repeat the process until you are satisfied with your results. You’ll reach 495 in six repetitions – once you get there, you will stay there.

It’s a clever trick that works with all numbers. It is also very generalizable. In fact, “the” Kaprekar number doesn’t actually contain 495 but 6174. This is because D. R. Kaprekar was an Indian mathematician, who originally used four-digit numbers to create the algorithm.

Let’s keep it at three, for now. Is this always going to work? Is there a way to get numbers other than 495? How could we know if they did?

Math problems are often very difficult to prove. In this instance, we have two options. We can either prove them using brains or brute force. The latter involves going through 990 cases one by one and comparing their results to determine if they are at 495. We’re going smart about this.

Step 1: Examine your base

Because base ten is the default in the West, we happen to be working there. To be clear, the proof can be used in any base. This means that you can find the constants in any base.

Step 2: Choose an arbitrary number

Here’s a math tip. When we refer to “arbitrary”, it doesn’t necessarily mean “random”. It can be something like abc, xyz or any other three-digit number that we want.

We will also use a mathematical trick and say “wloga>=b>=c” in English. This means that we assume that the digits are in descending order. If they are not, we can simply rearrange them so that it doesn’t matter what assumption we make.

Step 3: Write your number in a sum

Here is where the base comes into play. Let’s assume we choose abc. We know that 100 and b-ty C can be written like this: 100a +10b + c.

Step 4: Repeat the process in reverse

If abc is our starter number, it will be cba in reverse order. This sum will be 100c + 10b + an.

Step five: Make the difference

We have 100a + 10b+ c and 100c +10b+ a. So if we subtract the difference, we’ll get:

(100a + 10b + c) – (100c + 10b + a) = 100(a – c) + (c – a) = 99(a – c)

Step six: What does it tell us?

We have just shown that if we take the difference between a large to small three-digit number (or its reverse), it will always give us a multiple 99. It’s possible to do it, but it might seem somewhat incongruent given the facts. We promise it, but stick a pin in there.

Let’s reexamine the question: Is 495 really the only non-zero number produced by the Kaprekar Routine? Or, you could ask: Is 495 really the only nonzero number produced by the Kaprekar routine.

Although it may sound like semantics, this information is very helpful in the proof. We now have additional information about potential Kaprekar constants of three-digit numbers. We know that abc must be divisible by 99 and (a– c) if it is to be a constant.

Step seven: “Hand waving”

You can use the same arguments as in steps one through five to figure out that base ten (a – C) = 5.

Step eight: QED

What have we discovered? It is impossible to find a three-digit number that repeats under the Kaprekar method. It must also be 495 Hoorah! It was possible!

Let’s just prove it in all bases. And with four-digit numbers and five-digit numbers and so forth. It seems less stressful to just go back and read the urban legends of 399-year old Thai monks.