A curiosity journal of math, physics, programming, astronomy, and more.

Modulo tricks in other bases

In the previous post we used divisibility graphs to see why some common modulo tricks work, specifically for 3, 5, 9, 10, and 11. Why those particular numbers behave unusually isn't happenstance but because of the number's relationship to the chosen base.

In base 10, the divisibility graph for 10 has white edges that send all numbers back to zero:

0123456789
A divisibility graph for 10.

The same happens for numbers that are factors of 10:

0101234
Divisibility graphs for 2 and 5.

Nine behaves differently because it's one less than the base, and 3 does the same because it's a factor of 9:

012345678012
Divisibility graphs for 9 and 3.

Eleven behaves as it does because it's one more than the base:

012345678910
A divisibility graph for 11.

We can check this intuition by drawing divisibility graphs for similar numbers in other bases. In base 16, for example, white edges should go to zero for 2, 4, 8, and 16:

010123012345670123456789101112131415
Divisibility graphs for 2, 4, 8, and 16 in base 16.

All nodes should loop back to themselves for 3, 5, and 15:

0120123401234567891011121314
Divisibility graphs 3, 5, and 5 in base 16.

And white edges should mirror to the opposite side for 17:

012345678910111213141516
A divisibility graph for 17 in base 16.

Play around with other bases and email me if you find anything interesting.

What to do with this information we'll explore in the next post.