# Brain Teaser #3

If you subtract a three digit number (all digits unique) from another three digit number whose digits are reverse of the first number, you end up with another three digit number consisting of same digits, but in a different order:

xyz – zyx = zxy

What are those numbers?

Special thanks to Estera Stepanov for submitting this puzzle

1. jabbera says:

How about some math to solve this problem?

zyx = 100x + 10y + z

-zyx = -100z – 10y – x

zxy = 100z + 10x + y

This leaves you with

100x + 10y +z – 100z -10y -x = 100z + 10x + y

Which Simplifies to:

89x – 199z = y (*y can never be 0 here because 89 is prime and not a factor of 199)

You can rewrite this as two inequalities since we know y is constrained to 1 – 9

a) 89x – 199z >= 1

b) 89x – 199z <= 9

a) says: x >= ceil(.011 + 2.23z)

Since x is also constrained to 0 – 9 the only possible values for z are {1, 2, 3, 4}

Can’t be 0 beacuse of *

b) says x <= floor(.112 + 2.23z)

a and b can be rewritten together as:

ceil(.011 + 2.23z) <= floor(.112 + 2.23z)

Looking at the possible values for z, we can clearly see that 4 is the only one that solves this equation and it results in a value of x = 9.

Given x and z solving for y is trivial.

2. Dan says:

Another way to do it would be to notice right away that from 100x + 10y + z – (100z + 10y + x) we are  subtracting 10y from 10y.

This leaves 100(x-z) + (z-x) =  100z + 10x + y.

Since in the right side of the equation, we have 100z + 10x + b,

since x != 0 as that would cause us to have -99z = 100z + y or 199z = -y,

we can conclude that x = 9, as that would be the only way to have a digit in the 10 spot.

From there, we can narrow our formula to

801 = 199z + y, and we can conclude that z + 1 = y, as that is the only way to get the 1 as your ones digit.