Checking divisibility by large numbers

Here is the explanation to that link:

We know that $10 \cdot 7 = 70 \equiv 1 \mod 23$ as $3 \cdot 23 = 69$.

Thus, if we consider $10a + b \mod 23$ and we note that $7$ is coprime to $23$, then $10a + b \equiv 0 \mod 23 \iff 7(10a + b) = 70a + 7b \equiv a + 7b \equiv 0 \mod 23$

And that is how he got that $10a + b$ is divisible by $23$ iff $a + 7b$ is divisible by $23$. And this lets that blogger get rid of a digit, more or less, at each step to easily verify divisibility.


The idea behind "all those checkings" is to look at divisibility by computing the number you want to check divisibility modulo the divisor. For instance, the trick for computing divisibility by $11$ all reduces to $$ a \times 10^3 + b \times 10^2 + c \times 10 + d \equiv -a + b - c + d \pmod{11} $$ so that you can look at the alternated sum of the numbers instead of looking at the big one. You can develop a similar trick modulo $23$, for instance since $100 \equiv 8 \pmod {23}$, you have $$ a \times 100^2 + b \times 100 + c \equiv a \times 64 + b \times 8 + c \equiv a \times (-5) + b \times 8 + c \pmod {23}. $$ Perhaps the trick doesn't look quite as good, but that's because the tricks work well when the numbers are small or pretty (such as : it is easy to look at divisibility by $10000000000$).

Hope that helps,


He shows that any integer of the form $10a + b$ is divisible by 23 if and only if $a + 7b$ is divisible by 23. So for a number $n$ with more than one digit, you can repeatedly replace it with the number $a + 7b$, where $b$ is the last digit of $n$, and $a$ is the rest.

In his example, we have $n = 146096$ and we can write it as $10 \cdot 14609 + 6$, i.e. $a = 14609$, $b = 6$, and therefore $n$ is divisible by 23 if and only if $7a + b = 7 \cdot 14609 + 6 = 14651$ is. And we just repeat this until we have a small enough number.

As you can see, this is not a very practical test because we still have to do those multiplications.