2

Define $u$ to be an integer with a decimal representation $\overline{a_{n}a_{n - 1}a_{n - 2}\cdots a_{2}a_{1}a_{0}}$. Then, define $u'$ to be the integer whose decimal representation is the reverse order of the decimal representation $\overline{a_{0}a_{1}a_{2}\cdots a_{n-2}a_{n-1}a_{0}}$.

Writing $u$ and $u'$ in expanded form, \begin{align*} u &\;=\; (10^{n})(a_{n}) + (10^{n - 1})(a_{n - 1}) + (10^{n - 2})(a_{n - 2}) + \cdots + (10^{2})(a_{2}) + (10^{1})(a_{1}) + (10^{0})(a_{0}) \\ u' &\;=\; (10^{0})(a_{n}) + (10^{1})(a_{n - 1}) + (10^{2})(a_{n - 2}) + \cdots + (10^{n - 2})(a_{2}) + (10^{n - 1})(a_{1}) + (10^{n})(a_{0}) \end{align*}

By evaluating $u - u'$, we get $\displaystyle\sum_{k = 0}^{n}(10^{n - k} - 10^{k})(a_{k})$. For $u - u'$ to be divisible by 9, $(10^{n - k} - 10^{k})$ must be divisible by 9. Solving for the remainder of $(10^{n - k} - 10^{k})$ when divided by 9,

\begin{align*} r &\;\equiv\; (10^{n - k} - 10^{k}) \bmod 9 \\ r &\;\equiv\; (10^{n - k} \bmod 9) - (10^{k} \bmod 9) \\ r &\;\equiv\; \left((10 \bmod 9)^{n - k} \bmod 9\right) - \left((10 \bmod 9)^{k} \bmod 9\right) \\ r &\;\equiv\; \left(1^{n - k} \bmod 9\right) - \left(1^{k} \bmod 9\right) \\ r &\;\equiv\;1 - 1 \\ r &\;\equiv\; 0 \end{align*}

Since the remainder is zero, this implies that the difference of an integer and its reverse order is divisible by 9.


Is my proof correct, by any chance? I got curious about this when I used the calculator out of boredom.

I think the part where I solved for the remainder seems weird, but is there a chance that it is correct, though notationally wrong? If it is wrong, what should I do?

soupless
  • 2,344
  • 1
    For more information, see "casting out nines" https://en.wikipedia.org/wiki/Casting_out_nines – GEdgar Feb 17 '21 at 13:11

1 Answers1

1

Nice observation. You proof is correct but is perhaps longer than necessary.

Here is a more general fact:

Take an integer $u$ and write its decimal representation. Reorder the digits at will, to get another integer $u'$. Then $u-u'$ is divisible by $9$.

Indeed, if $u=(a_{n}a_{n - 1}a_{n - 2}\cdots a_{2}a_{1}a_{0})_{10}$, then $u \equiv a_{n}+a_{n - 1}+a_{n - 2}+\cdots a_{2}+a_{1}+a_{0} \bmod 9$, because $10^k \equiv 1 \bmod 9$. The same holds for $u'$, hence the result.

lhf
  • 216,483
  • I just found out that in $u - u'$ is divisible by 3. By the way, can I ask for a reference of your stated fact so I can make a mini-research? – soupless Feb 17 '21 at 13:17
  • 1
    @soupless, it follows directly from $10^k \equiv 1 \bmod 9$. See the comment by GEdgar. – lhf Feb 17 '21 at 13:31
  • 1
    $10\equiv 1 \bmod 9$ is a trivial observation, from this the rest follows because $a_{\bmod 9}+b_{\bmod 9}=(a+b){\bmod 9}$ and $a{\bmod 9}\cdot b_{\bmod 9}=(a\cdot b)_{\bmod 9}$ - ie that taking a modulus is compatible with addition and multiplication (and subtraction, but take care with division). – Mark Bennet Feb 17 '21 at 13:35