Binary divisibility automaton (source code)

= Binary divisibility automaton

For a positive integer $m$, binary strings can be tested for divisibility by $m$ with residue states $0,\ldots,m-1$ and transition
$$
r\xrightarrow{b}2r+b\pmod m,
\qquad b\in\{0,1\}.
$$
The initial and accepting residue is zero. For $m=7$, all seven states are reachable and pairwise distinguishable, so this automaton is minimal.