Logic circuit question
When reading a number, MSB first, you only need to keep track of the previous value modulo 3, not just the overall previous value, which is easily achievable with a simple transition table and three states. If input is zero, the following transitions can be shown to occur:


0 -> 0
1 -> 2
2 -> 1


If the input is 1, the following transitions occur instead:


0 -> 1
1 -> 0
2 -> 2


according to the rules of modular arithmetic.