Assume $a$ and $b$ are different one digit positive integer, both within range $[1,9]$. Then what is the possible maximum Greatest Common Divisor of two digits numbers $\overline{ab} ,\overline{ba}.$ ( $\overline{ab}$ means $a$ is the tens digit, $b$ is the ones digit. So $\overline{ab}=10a+b$).
A iterative way to iterate through $1-9$ of $a,b$ for 36 times can find the answer, I want to know any better mathematical way to solve the question. Thanks.
Let $D=\gcd(\overline{ab},\overline{ba})$. We have $$\tag1 D\mid \overline{ab}-\overline{ba}=9(a-b),$$ $$\tag2 D\mid a\cdot \overline{ba}-b\cdot \overline{ab}=a^2-b^2=(a+b)(a-b),$$ $$\tag3 D\mid 10\cdot\overline{ab}-\overline{ba}=99a.$$ $$\tag4 D\mid 10\cdot\overline{ba}-\overline{ab}=99b,$$ $$\tag5 D\mid \overline{ab}+\overline{ba}=11(a+b).$$ From $(1)$, $D$ cannot be difvisible by any prime $>7$ (provided $a\ne b$), hence we can cast out $11$ in $(3)$, $(4)$, $(5)$, and combine these into $$\gcd(a,b)\mid D\mid \gcd(9,a+b)\gcd(a,b). $$ Also from $(5)$, $D<18$ and in particular $27\nmid D$. Then the power of $3$ occuring in $D$ is the same as that in $a+b$ (by the digit sum rules for divisibility by $3$ and $9$). We conclude $$ D=\frac{\gcd(a,b)\gcd(a+b,9)}{\gcd(a,b,9)}.$$
In order to maximize, we can make $a+b$ a multiple of $9$ only by making $a+b=9$. Then $\gcd(a,b)\mid 9$ and $D=\gcd(a+b,9)=9$. Or we can make $a+b$ a multiple of $3$, but $3\nmid a,b$. Then $D=3\gcd(a,b)<9$. So the maximal gcd is $9$ and happens with $18$ and $81$, $27$ and $72$, etc.