Create a finite-state automaton that determines whether a binary number is divisible by five. The finite-state automaton from this challenge can be constructed as follows:
divisible = {
"S0": ["S0", "S1"],
"S1": ["S2", "S0"],
"S2": ["S1", "S2"]
}Each key is a state, and each value denotes instructions for each type of input. For "S0", the array ["S0", "S1"] indicates that if a 0 is received, the new state is "S0". If 1 is received, the new state is "S1".
"accept" would mean that the number is divisible by five, whereas "reject" means that it isn't."S0".