Consider the following problem:

1.30 Let Cn = { x | x is a binary number that is a multiple of n}. Show that for each n ≥ 1, the language Cn is regular.

Several people did not realize that problem 1.30 requires the representation of a number n in binary. Thus, for example, C7 would include strings such as the following:

but would not include these strings:

A machine for Cn can be constructed as follows:

Let M = (Q, Σ, δ, qs, F) be defined as follows:

If you don't want ε to be in the language, then add a separate start state qs and transitions δ(qs,0) = q0, δ(qs,1) = q1.

The proof of this construction is by induction on the length of the string. One can assume the following facts about modular arithmetic: