1

I sort of need an explanation on how can I demonstrate that a language formed by strings that are multiples of k, is a regular language

I really dont know how

Marie
  • 11
  • 1

2 Answers2

2

Generalizing the other answer, here is a complete classification of regular language of this sort.

The language $\{ x \in \Sigma^* : |x| \in S \}$ is regular iff there exist $n \geq 0$ and $k \geq 1$ and sets $A \subseteq \{0,\ldots,n-1\}$, $B \subseteq \{0,\ldots,k-1\}$ such that $$ S = A \cup \{ n+ mk + r : m \geq 0, r \in B\}.$$

One direction follows from a direct construction (either a DFA or a regular expression), and the other from the pumping lemma (exercise) or Parikh's theorem.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
1

I assume that you wish to demonstrate that $L = \{ w \in \Sigma^* \colon |w| = k, 2k, ...\}$ for some $k > 0$ is a regular language (correct me if I am wrong).

If that is the case, all you need to do is to construct a DFA $M$ such that $L(M) = L$:

DFA

coderodde
  • 52
  • 1
  • 12