## The price of the gift

Solution sent by the visitor ** Renato Santos**:

Let the price of the gift be expressed as a four-digit number, neglecting the pennies, such as abcd (ie $ abcd, 00), where **The** is 1 or 0 (for $ abcd, 00 to be less than or equal to $ 1,200) and b, c and d, of course, are between 0 and 9. Read the opposite, the gift price would be dcba, which should be value of nine gifts.

In order to equate this information, we have to take into account the positional decimal notation, ie, abcd means a thousand, b hundreds, c tens and d units, or 1000a + 100b + 10c + d. Similarly, dcba means 1000d + 100c + 10b + a. Stays like this:

1000d + 100c + 10b + a = 9 (1000a + 100b + 10c + d)

or

1000d + 100c + 10b + a = 9000a + 900b + 90c + 9d

Resolving:

(1000-9) d + (100-90) c + (10-900) b + (1-9000) a = 0

or

991d + 10c -890b -8999a = 0

Note that 991 and 10 have no factors in common, and therefore in this case we cannot reduce the coefficients of the equation. We have here a single equation with four unknowns. One strategy would be to substitute tentative values for a, b, c and d.

One can, however, like Diophantus, henceforth use the continuous fraction algorithm:

We left isolate the term with the lowest coefficient:

10c = 8999a + 890b - 991d

We divide the whole equation by the coefficient:

c = (8999/10) a + (890/10) b - (991/10) d

Separating whole parts from fractions,

c = 899a + (9/10) a + 89b - 99d - (1/10) d

or

c = 899a + 89b - 99d + (1/10) (9a - d)

Since a, b, and c must be integers, (1/10) (9a-d) must also be. This, of course, will only happen if (9a-d) is a multiple of 10.

However, since a, b, c and d represent the digits of the present value, they must be between 0 and 9. With this restriction, (9a-d) can only be the trivial multiple of 10, that is, 0.

It looks like 9a - d = 0

or

d = 9a

Returning this result to the previous equation, we get

c = 899a + 89b - 99x9a + (1/10) (9a - 9a)

or

c = 899a + 89b - 891a

c = 8a + 89b

Since c is between 0 and 9 and the coefficients of a and b are positive, it follows that b must be equal to 0 so that c does not exceed 9.

c = 8a

Let us also remember that a is 1 or 0.

But a = 0 results in the trivial case a = 0, b = 0, c = 0 and d = 0, ie the price $ 0000.00 and, correctly, 9 x 0000 $ 00 = 0000 $ 00.

We then have a = 1 which results in c = 8 and, returning to the previous equation, d = 9a => d = 9.

Thus we finally get the price of the gift ($ abcd, 00) as $ 1089.00 which, inverted, results $ 9801 = 9 x $ 1089, as desired.

**ANSWER: The gift cost $ 1089**

Solution sent by the visitor ** Paulo Martins Magalhães**:

If the amount set aside for the gift was $ 1,200, we must assume that the price was around $ 1,000.

So we were looking for a 4 digit number, 1 being the first one. The last digit could only be 9, because only then could we invert the number and get 9 times the first.

Thus, we know that the number is 1ab9.

Finding a and b is relatively easy, since the number is a multiple of 9, since its inverse is the same (since it is a number worth nine times the price of the present). So we have the number 1ab9. For such a number to be a multiple of 9, the sum a + b must be 8. The pairs a and b that satisfy this condition are as follows: 0 and 8; 1 and 7; 2 and 6; 3 and 5; 4 and 4; 5 and 3; 6 and 2; 7 and 1 and finally 8 and 0.

Testing the first pair, which seems more logical because the price is less than $ 1,200, we get $ 1,089, which is the price of the gift. (1089 X 9 = 9801).

Back to the statement