<s>[INST] Divisibility Rule for 21 similar to rule for 12 I already understand the divisibility rule for 12. $$10\equiv -2 \pmod{12} \implies 10^n\equiv (-2)^n  \pmod{12}$$
Then for some number $n = abcd = 1000a + 100b + 10c + d,  abcd\equiv1000a + 100b + 10c + d \pmod{12}$
Then  $abcd\equiv (-2)^3a + (-2)^2b + (-2)c + d$
Example:  $7368\equiv -8*7 + 4*3 -2*6 + 8\equiv -48\equiv 0 \pmod{12}$
But why does it work for 21 as well?
If I switch the order that the power rises in, so that now it is $a + (-2)b + (-2)^2c + (-2)^3d$ now, all of a sudden, it works for mod 21
Example: $2331\equiv 2 + (-2)*3 + (-2)^2*3 + (-2)^3*1 \equiv 0 \pmod{21}$
It's obvious why this works for numbers like $48$ and $84$ since with both you are multiplying $4 * -2$ and $8 * 1$ and their sum is then $0$ for both.
But why does it still work for numbers like $105$.
$501$ is obviously not divisible by $12$ and yet: $105\equiv 1 + (-2)*0 + (-2)^2*5\equiv 21 \equiv 0 \pmod{21}$
I'm also fairly sure this is part of the reason that $f$ works in Proof of general divisibility rule
 [/INST] For $21$, the reason this works is that $10\times(-2)=1\pmod{21}$, so $10\equiv(-2)^{-1}\pmod{21}$. Hence
$$1000a+100b+10c+d\equiv(-2)^{-3}a+(-2)^{-2}b+(-2)^{-1}c+(-2)^{0}d\pmod{21},$$
so multiplying the RHS by $(-2)^3$ implies the result.
You will observe a similar result for all teen numbers $\overline{1m}=10+m$, because
$$10\times(-m)\equiv-\overline{m0}\equiv1\pmod{\overline{m1}}.$$
</s>