0. Take any non-negative integer in base 10; for example, 4523.

1. Start at the most significant digit; in our example 4.

2. Now follow the hollow arrow once; i.e., we go to 1.

3. Now follow the solid arrows as many times as the next most significant digit; i.e., we follow the solid arrows 5 times to get 6.

4. Repeat steps 2-4 until you are at the least significant digit; i.e., we follow the hollow arrow to 8, then the solid arrows 2 times to 10, the hollow arrow to 9, and finally the solid arrows 3 times to 12.

5. Whatever number you end up at is your original number mod 13.

6. Memorize the graph to impress your friends.

7. Now figure out how to make your own for different bases and modulo different numbers.

Aleksander BalickiImpressive, if you don’t know Deterministic Finite Automata (DFA).