Solution (source code)

= Solution

Five distinct states require \b[three <D flip-flops>], since $2^2<5\leq2^3$. Choose the <state encoding> $S_i$ equal to the three-bit binary expansion of $i$. Write the present bits as $A,B,C$, in decreasing significance. The <state transition table> is
$$
\begin{array}{c|cc|c}
ABC&x=0:\ A^+B^+C^+&x=1:\ A^+B^+C^+&y\\\hline
000&000&001&0\\001&000&010&0\\010&011&010&0\\011&000&100&0\\100&000&010&1\\101&---&---&-\\110&---&---&-\\111&---&---&-
\end{array}.
$$
The dashes are <don't-care conditions> for minimizing the logic. They do not prescribe what the actual circuit will do in those unused states; part (e) determines that from the chosen equations.