# A peculiar number

A five digit number is multiplied by 9, the resulting number is reverse of the given number. What is the five digit number? This question was asked in KVPY 2020, SA.

The number should be:

10989

Proof:

Let's first deconstruct our 5-digit number as $$abcde$$, giving us a formula like such: $$9*(10000a + 1000b + 100c + 10d + e) = 10000e + 1000d + 100c + 10b + a$$ Solving this equation, we can get: $$89999a + 8990b + 800c = 910d + 9991e$$ implying that $$a = 1$$ and $$e = 9$$ by looking at the last digits.
We then continue solving:
$$8990b + 800c = 910d + 80$$
$$899b + 80c = 91d + 8$$
Finding this, we can then see that either $$b = 1$$, (meaning $$d = 1$$ and $$899 + 80c = 99$$, the latter equation having no possible solutions) or $$b=0$$, which gives us $$91d - 80c = 8$$, having unique solutions $$d=8$$ and $$c=9$$.

Here is a slightly different approach (same answer of course).

  ABCDE
x    9
======
EDCBA


Multiplying the 5-digit number by 9 results in another 5-digit number so the highest digit does not overflow. So A must be 1 or 0 but if A were 0 it would be a 4-digit number so it is 1.

 1BCDE
x    9
======
EDCB1


Since the 9 in the product didn't overflow it must not have had a carry coming into it. Also, the only way to end up with a 1 in the one's column of the product is to multiply 9 by 9 (and carry an 8 to the ten's column).

 0  8
1BCD9
x    9
======
9DCB1


Since B times 9 did not produce an overflow, it must be either 1 (with no carry coming into it) or 0 (with any amount of carry coming in). First let's try 1.

 0078
11C79
x    9
======
99C11


The two numbers contradict. So D must be 0.

 0 88
10C89
x    9
======
98C01


Now, in order to end up with an 8 in the thousand's column of the product, 8 must have been carried in from the hundred's column. C can be either 8 or 9. Let's try 8.

 0888
10889
x    9
======
98001


8 leads to a contradiction so C must be 9.

 0888
10989
x    9
======
98901


I came up with a crude, logical solution utilizing some minor brute force rather than a mathematical formula.

We know our given and reverse numbers must be 5 digits in length. It's pretty easy to determine upper and lower limits for our given number to be 10000 and 11111. Anything lower than 10000 would have 4 digits, and anything higher than 11111 multiplied by 9 would give us a 6-digit number. (11112 * 9 = 100008)

10000
11111

Using this, we know the first digit of our given number must be "1" and therefore the last digit of its reverse must be "1".

1xxxx * 9 = xxxx1

We can also determine that the last digit of our given number must be "9", as that is the only number you can multiply by 9 to give us "1" in our reverse number.

1xxx9 * 9 = 9xxx1

Next, I needed to find the number in the tens column of our given number. 9 * 9 would give us 81 in the last two digits of our reverse number or 18 in the first two digits of our given number. 18xx9 is above the upper limit of 11111 for our given number.

With a little brute force, we find the only number we can use here is "8". Anything else multiplied by 9 leaves us with something outside of our upper limits when reversed.

19 * 9 = 171
17109

29 * 9 = 261
16209

...

89 * 9 = 801
10809

So we have:

1xx89 * 9 = 98xx1

We can use this to determine the first two digits of our given number and last two digits of our reverse number to be 10/01. Anything else is outside our limits.

10x89 * 9 = 98x01

It's easy enough to brute force the last digit by multiplying until you find the solution.

10089 * 9 = 90801
10189 * 9 = 91701

...

10989 * 9 = 98901

I know this isn't 100% mathematically sound/relies on some brute force. I apologize if this does go against any guidelines. I couldn't find any rules stating such, only that the solution need to adequately answer the question with work shown. In my subjective opinion, I do think this solution is easier and faster than most formula-based solutions for those who aren't quite as mathematically inclined.

Is brute force allowed? If so then:

for i in range(10000, 100000//9):
if str(i) == str(i*9)[::-1]:
print(i)

10989

And BTW,

for j in range(2,10):
for i in range(10000, 100000):
if str(i) == str(ij)[::-1]:
print(j,'times',i,'=',ij, 'is the reversed of', i)

4 times 21978 = 87912 is the reversed of 21978
9 times 10989 = 98901 is the reversed of 10989

Apparently it also works for 5-digit numbers multiplied by 4.. who knew!

!I resorted to a calculator after my middle digit was off by 1, but mostly you can do this by basic logic.

* The number is less than 11111, because it multiplies by 9 to a 5-digit number. A number starting with 0 is not reasonably called 5-digit, so that means the first digit is 1.

* The first digit will come out to be 9, so the last digit is 9.

* The second digit could be 0 or 1. But 11009 x 9 = 99081. To get the 8 up to a 1, we have to increase the second-to-last digit so that it gives a 3 in the ones place, i.e. it is 7. We can't increase 11009 in a way that gives a 7 in the second position, so the second digit is 0.

* The fourth digit now has to multiply to cancel out the 8 and turn it to 0. That means it has to be 8 x 9 = 72. We now know it is 10x89.

* Taking 10089 x 9 = 90801. We need to get the second digit up to an 8, so we need the third digit to start as an 8 x 9 = 72. (Note the carried 1 I forgot about)