<s>[INST] Base $7$ is backwards base $16$ Find the sum of all positive integers such that their expression in base $7$ digits is the reverse of their expression in base $16$ digits. Express your answer in base $10$.
I tried expressing the digits as $d_1$ $d_2$... and making separate equations but that didn't work. Help!
 [/INST] In particular, these numbers have at most as many digits in base seven as they have in base sixteen. So, if $16^{k-1} \leq n < 16^{k}$ is such an integer, then $n$ has at most $k$ digits in base $7$, so $n < 7^k$. Thus $16^{k-1} < 7^k$. This forces $k \leq 3$. By assumption, you know that $n$ has as base-16 digits only $0,1,2,3,4,5,6$.
The one-digit numbers contribute $21$.
For the two-digit numbers: write $n$ as $ab$ in base $16$. Then $16a+b=7b+a$, so $15a=6b$ ie $5a=2b$, so $a=2,b=5$ is the only solution, ie $n=37$.
For the three-digit numbers: write $n$ as $abc$, then $256a+16b+c=49c+7b+a$, thus $255a+9b=48c$, hence $85a+3b=16c$. As $a > 0$, $c > 5$ so $c=6$ and $3|85a$, so $16c=85a+3b > 255$, so $c > 6$, impossible.
So finally it’s $21+37=58$.
</s>