I came across the following problem on a puzzle website the other day. A $3$ digit number is written $(xyz)_{10}$ in base $10$ and $(zyx)_9$ in base $9$. What is it?
The website (which I think intended this as a programming problem) said just to brute force it, but I feel like this can be done more elegantly. In particular, here is my attempt at a solution:
We can consider our number modulo $9$ and $10$ to get some simple linear equations involving the digits. In particular, $x+y+z \equiv x \pmod 9$ and $z = x - y + z \pmod {10}$, and so $y + z = 9$ and $x=y$. Writing everything in terms of $x$, we have
$$ 100x + 10x + (9-x) = 81(9-x)+ 9x +x \Rightarrow 109x + 9 = 729 -71x \Rightarrow x = 720/180 = 4$$
Thus, the number is $445=(544)_9$
A slight variant of this solution would be to consider $(xx[9-x])_10=([9-x]xx)_9$ modulo $7$ to obtain $[9-x]+3x + 2x \equiv x + 2x + 4[9-x] \pmod 7 \Rightarrow 2+4x \equiv 1-x \pmod 7$ and so $2x=1 \pmod 7$. Since $0\leq x \leq 8$, this once again yields that $x=4$.
What are some other approaches to this problem?
$1\le x\le 8, ~~ 0\le y \le 8, ~~ 1\le z \le 8$ (Thanks to MPW for improvement/corrective).
$$100x+10y+z = 81z+9y+x$$ $$99x+y = 80z$$ $$19x+y=80(z-x)$$
$19x+y$ must have 80 as a factor (only $2$ possible values: $80$ and $160$).
a) if $x\le 3$, then $19x+y\le 65$;
b) if $x=4$, then $19x+y=80$, when $y=4$ (then $z=y+1=5$);
c) if $5\le x \le 7$, then $95\le 19x+y\le 141$;
d) if $x=8$, then $19x+y=160$, when $y=8$ (but then $z$ must be $y+2=10$: impossible).
So, only $x=4,y=4,z=5$ is the solution.