Home > Riddles > The code with checksum and reverse

The code with checksum and reverse

Numerical territoryLevel 5 · Expert · ●●●●●

A code has four different digits.
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 its figures, the new number is 369 greater than the original.

What is the code?

Didactic closure of the level

A good expert solution combines two things: proof of possibility and explicit construction.

Hints

Show hints
  1. The reverse condition is $dcba-abcd=369$, equivalent to $999(d-a)+90(c-b)=369$.
  2. Also, by checksum: $d\equiv a+b+c \pmod{10}$. Replacing $d=a+1$ and $c=b-7$: $a+1\equiv a+b+(b-7)\pmod{10}\Rightarrow 2b\equiv 8\pmod{10}\Rightarrow b\equiv 4\pmod{5}$.
  3. Since $c=b-7$ must be a digit, $b\in\{7,8,9\}$; then $b=9$ and $c=2$.

Solution

Show full solution

Back to problem
Answer:

$$ 3924. $$

Let the code be $abcd$.
The condition of the reverse:

$$ dcba-abcd=369. $$

Equivalent to:

$$ 999(d-a)+90(c-b)=369. $$

Dividing by 9:

$$ 111(d-a)+10(c-b)=41. $$

The only integer possibility in digit range is:

$$ d-a=1,\qquad c-b=-7. $$

Additionally, by checksum:

$$ d\equiv a+b+c\pmod{10}. $$

Replacing $d=a+1$ and $c=b-7$:

$$ a+1\equiv a+b+(b-7)\pmod{10} \Rightarrow 2b\equiv 8\pmod{10} \Rightarrow b\equiv 4\pmod{5}. $$

As $c=b-7$ must be digit, $b\in\{7,8,9\}$, then $b=9$ and $c=2$.
That leaves $a$ using “multiple of 9”:

$$ a+9+2+(a+1)=2a+12\equiv0\pmod9 \Rightarrow 2a+12=18 \Rightarrow a=3. $$

So $d=4$.
Code:

$$ 3924. $$

Related riddles

Keep practicing

If you enjoyed this one, try more pure-logic riddles, explore this theme, browse the full archive, or read the riddle-solving guide.

← Previous: The magician and the five cards · Next: Unique messenger route (graphs) →