Construct a Mealy machine that counts modulo 5,
Let's assume, E = {0, 1, 2, 3} (Input strings in Base 4 number system)
and, = {0, 1, 2, 3, 4} (As we have to count modulo 5)
Transition Table:
States | 0 | 1 | 2 | 3 |
-> q0 | q0/0 | q1/1 | q2/2 | q3/3 |
q1 | q4/4 | q0/0 | q1/1 | q2/2 |
q2 | q3/3 | q4/4 | q0/0 | q1/1 |
q3 | q2/2 | q3/3 | q4/4 | q0/0 |
q4 | q1/1 | q2/2 | q3/3 | q4/4 |
Required Mealy Machine:
Sample Input:
Let's take 12 as our input string (decimal equivalent of 12 is 6) and 6 mod 5 is 1.
Now, if we input 1 to q0 it goes to q1, and q1 on getting input 2 goes to q1 itself and gives the final output symbol 1 which is our required answer for 6 mod 5.
Get Answers For Free
Most questions answered within 1 hours.