If the number is 325, then follow 3 black arrows, then 1 white arrow, then 2 black arrows, then 1 white arrow, and finally 5 black arrows.

If you end up back at the white node, n is divisible by 7.

Source: http://blog.tanyakhovanova.com//?p=159

Why does it work?

### Like this:

Like Loading...

*Related*

## About benvitalis

math grad - Interest: Number theory

I believe that you mean that I have to start from 0. And if I ended at 0, then the number is divisible by 7.

Is it some sort of finite state automata? I seem to remember making diagrams like these for numbers in my theoretical computer science class.

The diagram represents multiplication by 10 modulo 7. One can build similar graphs for any modulus and any base system