16,497 views

4 Answers

4 votes
4 votes

Ist one is correct 

binary no ,i.e, symbols are {0,1}   [base =2]

divisible by 2  i.e states are 0,1   representing remainder on dividing 2.

[base x state + input symbol ] mod 2  $\rightarrow$ state  

for example state is 1 and input symbol is 0 , that is(10) represent  [1 x 2 + 0 ]  = 2 and on dividing by 2 it gives remainder 0 

so[1 x 2 + 0 ] mod 2 = 0

similarly for state 0 transitions are 

[ 0 x2 + 0] mod 2 $\rightarrow$ 0

[ 0 x2 + 1] mod 2 $\rightarrow$ 1

for state 1 

[ 1 x2 + 0] mod 2 $\rightarrow$ 0

[ 1 x2 + 1] mod 2 $\rightarrow$ 1

resulting in following DFA

2 votes
2 votes

Divisible by n , so there should be n states starting from 0 to (n-1).

let's take m % n = 0 , where m is the input number .

so , the final state should be 0 .( as remainder in 0 )

For the number being divisible by 0 , the numbers can be { 0 , 10 , 100 , 110 , 1000 , 1010 .... }

So , the minimal DFA will be :

Similarly in the same manner DFA for binary number divisible by 3 will be :

Now , let's see another type of question where remainder is not zero , like find all binary numbers which when divided by 2 produces remainder 1.

So , here the number of states will be 2 , Remainder is 1 , so final state will be 1.

So , in the same way you can draw DFA for any divisiblity problem

edited by
1 votes
1 votes
I think both of your DFA are correct, a binary number divisible by 2 must not end with 1 i.e (1110,10100.. etc all divisible by 2), and both of your dfa are working correctly for it.
0 votes
0 votes
Let's draw the  dfa which doesn't accept binary string divisible by 2 I.e a string starting with 1. Now draw the complement of the dfa and you are done.

Related questions

14 votes
14 votes
5 answers
4
Vikrant Singh asked Feb 1, 2015
4,353 views
No. of states in the minimal finite automata which accepts the binary strings whose equivalent is divisible by 32 is ________?A. 5B. 6C 31D 32