# Choose a four-digit number, with each digit different and finding the method

Im reading a new york times article. Here is the link if anyone is interested:

and i see this problem:

Choose a four-digit number, with each digit different. Scramble the digits to create a new number. (For instance, if your first number is $2,357$, your second number might be $7,325$.) Subtract the smaller number from the larger, and add together the digits of the resulting number. If your sum is one digit, go no further. If your sum is a two-digit number, then add the two digits together.

I am trying to see how the number would be $9$ but i dont quite understand the problem.

Lets use the number in the problem $2,357$ and follow the steps:

1. Choose a four digit number: $2,357$
2. Scramble: $7,325$

What do they mean subtract the smaller number from the larger.

I interpreted it as: $7-2=5$ and then add $5+3+5=13$ that is clearly not $9$

then i thought subtract the digits of $7,325, 2,357$. so $7-2=5$,$3-3=0$, $2-5=-3$ and $5-7=-2$ but when you add the result up you get $0$

So can anyone help me understand what they mean in the bold parts.

ANSWER to question: Your number is $9$.

• As it so happens, the "with each digit different" condition is unnecessary. So long as the the scrambled number is different than the unscrambled number, this will work. – JMoravitz Oct 15 '15 at 2:00

If you have a number $n$ and a number $n'$ which is formed by a permutation of the digits of $n$ (other than the identity permutation), then if $n'>n$ consider $n'-n$. This new number, apply the sum of digits operation to it.

Say for example $n=2357$ and $n'=7325$. We have that $n'>n$, so we consider the number $n'-n = 7325-2357=4968$. Applying the digitsum operation, we have $4+9+6+8 = 27$. Since this is not yet a one digit number, apply it again to arrive at $2+7 = 9$.

As for why this works, first, note that if $n=1000a + 100b + 10c + d$ is your four digit number (with each $a,b,c,d$ digits $0$ through $9$), that $n\equiv a+b+c+d\pmod{9}$

That is to say, the sum of the digits of a number is congruent to the original number modulo $9$.

It follows, then, that any permutation of the digits of your four digit number will again result in a number equivalent to $n$ modulo $9$. Let the new number be called $n'$.

You have then $n-n' \equiv 0\pmod{9}$. The only way that the sum of the digits of a positive number is zero however is if all digits are identically zero. Since we are taking the larger of the two (implying that the rearrangement cannot be identical to the original), the only possibility will be some nonzero multiple of $9$.

By repeatedly adding the digits again, you will arrive at $9$.

These are digital roots (q.v.). The digital root of a positive number divisible by $9$ is $9$; otherwise, the digital root is the remainder after the number is divided by $9$.

https://en.wikipedia.org/wiki/Digital_root

Since permuting the digits of a number doesn't change its digital root, both the original number and its permutation must leave the same remainder (possibly $0$) when divided by $9$; therefore, their difference is itself divisible by $9$. Ergo, that difference must have a digital root of $9$.

First you have to know that $10^r - 1 = (10 - 1)(10^{r-1} + 10^{r-2} + \cdots + 10 +1 ) = 9(10^{r-1} + 10^{r-2} + \cdots + 10 +1 )$ So $10^r -1 \equiv 0 (\mod 9)$ for any integer $r$. And the same thing hold for $1- 10^r$. So if you have $n> m$ then $10^n - 10^m = 10^m ( 10^{n-m} - 1)$ and the last parentheses is divisible by $9$ for the reason mentioned above

Now if you have a number with four digits $abcd = d + 10 c + 100 b + 1000a$ Scramble the digits for example $bcda = a + 10d + 100c + 1000b$

Subtract

$abcd - bdca = d + 10 c + 100 b + 1000a - ( a + 10d + 100c + 1000b)$ $abcd - bdca= a(1000 - 1) + b ( 100 - 1000) + c(10 - 100) + d (1 - 10)$ each parentheses is divisible by 9