Decimal/hex palindromes: why multiples of 53?

A previous question 371 = 0x173 (Decimal/hexidecimal palindromes?) described numbers whose decimal and hex representations are reversed of each other.

Other than the trivial one-digit numbers, there are only $5$ numbers with this property. My question: why are they all multiples of $53$?

$$53 = 35_{16} = 53 \times 1$$

$$371 = 173_{16} = 53 \times 7$$

$$5141 = 1415_{16} = 53 \times 97$$

$$99481 = 18499_{16} = 53 \times 1877$$

$$8520280 = 0820258_{16} = 53 \times 160760$$


Solution 1:

The palindrome condition given is a special case of a sequence of positive integers $\{a_i\}_{i=0}^n$ that satisfies $$ N = \sum_{i=0}^n a_i 10^i = \sum_{i=0}^n a_i 16^{n-i} $$ In this case it follows that $$ a_0 = \frac{\sum_{i=1}^n a_i\left(10^i-16^{n-i}\right)}{16^n-1} $$ Then we can write $$ \begin{align} N & = a_0 + \sum_{i=1}^n a_i 10^i \\ & = \sum_{i=1}^n a_i \left(10^i+\frac{10^i-16^{n-i}}{16^n-1}\right) \\ & = \frac{1}{16^n-1} \sum_{i=1}^n a_i \left(16^n10^i-16^{n-i}\right) \\ & = \frac{1}{16^n-1} \sum_{i=1}^n a_i 16^{n-i}\left(160^i-1\right) \end{align} $$ Since $159 \mid 160^i-1$ for every $i\ge 0$, and $\operatorname{ord}_{53} 16 = \operatorname{ord}_{53} 10 = 13$, then if $13 \nmid n$ we must have $53 \mid N$.

Of course this generalizes to bases $B_1,B_2$. If $$ N = \sum_{i=0}^n a_i B_1^i = \sum_{i=0}^n a_i B_2^{n-i} $$ then we can write $$ N = \frac{1}{B_2^n-1}\sum_{i=1}^n a_i B_2^{n-i} \left((B_1B_2)^i-1\right) $$ and similarly $$ N = \frac{1}{B_1^n-1}\sum_{i=0}^{n-1} a_i B_1^i \left((B_1B_2)^{n-i}-1\right) $$ and hence $N$ is divisible by $$ \frac{B_1B_2-1}{\gcd(B_1B_2-1,B_1^n-1,B_2^n-1)} $$

For example, we can find a similar pattern for palindromes in bases $10$ and $13$. $10\times 13-1 = 43\times 3$ and $\operatorname{ord}_{43} 10=21$, so for $0<n<21$ digits paired palindromes in these bases are divisible by $43$, e.g. $$ 43_{10} = 34_{13} \\ 774_{10} = 447_{13} = 43 \times 18 \\ 218870_{10} = 078812_{13} = 43 \times 5090 $$

For an example where the pattern breaks down, let $B_1=4,B_2=5$, then $B_1B_2-1 = 19$. Then we have $$ 1030_4 = 0301_5 = 19 \times 4 \\ 1212020_ = 0202121_5 = 19 \times 344 $$ But $\operatorname{ord}_{19} 4=\operatorname{ord}_{19} 5=9$, so when $n=9$ we have $19 \mid \gcd(B_1^n-1,B_2^n-1)$ and it may get canceled. For example $$ 2103133210_4 = 0123313012_5 = 2^2 \times 89 \times 1697 $$