DFA Category 5: Divisibility ( Binary Numbers)

DFA accepts binary strings whose decimal representation is divisible by a number. For Examples

  • Binary strings divisible by 2
  • Divisible by 3 
  • Divisible by 5

DFA Example 

Construct a DFA that accepts the set of all strings over {0, 1} when interpreted as a binary number that is divisible by 2.

  • Language of Accepted Strings = {0, 10, 100, 110, 1010, 1110, …} (binary strings ending in 0 → divisible by 2)
  • Some Rejected Strings = {1, 11, 101, 111, 1001, 1101, …} (binary strings ending in 1 → not divisible by 2)

DFA Example:

Construct DFA, which accepts all the string over alphabets ∑ {0,1} where binary integers divisible by 3

  • Language of Accepted Strings = {0, 11, 110, 1001, 1100, 1111, 10010, …} (binary numbers divisible by 3)
  • Some Rejected Strings = {1, 10, 101, 1110, 100, 1010, 1001, 111} (binary numbers not divisible by 3)

DFA Example:

Construct DFA that accepts all the strings over alphabet ∑ {0,1} where binary integers are divisible by 4

  • Language of Accepted Strings = {0, 100, 1000, 1100, 10000, 100100, …} (binary integers divisible by 4)
  • Some Rejected Strings = {1, 10, 11, 101, 111, 1010, 1101, 1001} (binary integers not divisible by 4)

DFA Example:

Construct a DFA that accepts the set of all strings over {0, 1} when interpreted as a binary number, that is, divisible by 5.

L = { 0, 101, 1010, 1111, 10100, 11001, 11110, … }

DFA Example: 

Draw a DFA for the language accepting Odd binary numbers strings over the input alphabet Σ = {0,1}

  • Language of Accepted Strings = {1, 11, 101, 111, 1001, 1101, …} (binary numbers ending in '1', i.e., odd)
  • Some Rejected Strings = {ε, 0, 10, 100, 110, 1110, 1010} (binary numbers ending in '0', i.e., even)

DFA Example: 

Draw a DFA for the language accepting Even or Odd binary numbers strings over input alphabets Σ = {0,1}

  • Language of Accepted Strings = {ε, 0, 1, 10, 11, 101, 1110, 1101, …} (all binary strings)


Comments

Popular posts from this blog

Theory Of Computation PCCST302 KTU Semester 3 BTech 2024 Scheme

Non deterministic Finite Automata NFA

Example DFAs University Questions