Library

Moore · Rational transduction

The running remainder mod 3

The divisibility-by-3 DFA with its answer written out at every step: each state prints its remainder, so the output is the value of every prefix of the binary number, mod 3. A Moore machine prints one symbol more than it reads — the start state’s, before anything has been read.

r0r1r2010101
The machine as drawn — 3 states, 6 transitions.

The author’s examples, run

0 → reject · 001 → reject · 0100 → reject · 00001 → reject · 001000 → reject · 00001111101100011000 → reject · 01010122212101212