A four-digit code leaves three traces: a sum, a multiple, and what happens when you read it backwards. Three conditions for a single number.
The code with checksum and reverse
Riddle statement
A code has four different figures.
It is known that:
- is a multiple of 9;
- the last figure is the remainder by dividing the sum of the first three by 10;
- By reversing the order of its figures, the number obtained exceeds the original by 369 units.
What is the code?
Show solution
Solution
Answer:
Let the code be $abcd$. The number obtained by inverting its figures is $dcba$.
As this reverse exceeds the original by 369 units:
Es say:
Grouping:
Dividing by 9:
As $a, b, c, d$ are figures, the differences $d - a$ and $c - b$ are between $-9$ and $9$. The only integer combination that satisfies the equation is:
so that:
Now we use the condition of the last figure:
Substitution $d = a + 1$ and $c = b - 7$:
then:
so that:
So $b$ must be congruent with 4 modulo 5. Since $c = b - 7$ must be a valid figure, $b$ can only be 7, 8 or 9. Of those three values, the only one congruent with 4 modulo 5 is $b = 9$, which gives $c = 2$.
Finally, the code is a multiple of 9, so the sum of its figures must be:
The only figure $a$ that makes this sum a multiple of 9 is $a = 3$, so $2(3) + 12 = 18$. Then $d = 4$.
The code is $\mathbf{3924}$.
Check: the four figures are different; $3 + 9 + 2 + 4 = 18$, multiple of 9; $3 + 9 + 2 = 14$, whose remainder when divided by 10 is 4; the reverse is 4293, and $4293 - 3924 = 369$.