# $x-1$ in base $x$ counting systems

Please excuse the lack of expertise. I'm not a mathematician, nor have I studied it since high school.

I was thinking about how all the digits of multiples of $9$ summed equal a multiple of $9$.

I was musing on how miraculous this seemed, but I soon turned skeptical and wondered if it was a product of our base $10$ counting system.

I did a thought experiment, attempting to see if such a thing existed in a base $9$ counting system. It worked for the digit $8$. Subsequently, every time I checked in every counting system, the final digit ($x-1$, where $x$ is the base of the counting system) follows the same pattern.

For example, in a base $9$ system: $8 \times 2 = 17$

$1 + 7 = 8$

In a base $5$ system: $4 \times 3 = 22$

$2+2 = 4$

I'm wondering if this has a name. I tried looking it up, but I don't know enough mathematical jargon to figure out a decent search criteria.

Thanks.

The easiest way to explain it is by using modular arithmetic, where the integer number line wraps around a circle. Two numbers are congruent modulo $n$, written $$a \equiv b \pmod{n}$$ if they give the same remainder upon division by $n$. Equivalently, $a \equiv b \pmod{n}$ if $n$ divides $a - b$.
How is this relevant? In base $n+1$, a number is expressed as a polynomial of degree $d$ (number of digits) with coefficients in $\{0, 1, \dots, n \}$:
$$a = a_d (n+1)^d + a_{d-1} (n+1)^{d-1} + \dots + a_2 (n+1)^2 + a_1 (n+1) + a_0$$ The congruence $n + 1 \equiv 1 \pmod{n}$, allows you to reduce this to \begin{align} a &\equiv a_d (1)^d + a_{d-1} (1)^{d-1} + \dots + a_2 (1)^2 + a_1 (1) + a_0 \pmod{n}\\ &= a_d + a_{d-1} + \dots + a_2 + a_1 + a_0. \end{align}
When $n = 9$, you can reduce a base $n + 1 = 10$ number to the sum of its digits modulo $9$. (And if that sum is congruent to $0 \pmod{9}$, then you have a multiple of $9$.) However, there's no reason $n$ has to be $9 \dots$