Regular expression for strings with length not a multiple of 10

1.9k Views Asked by At

Let $P = \{z^n \mid \text{$n$ is not divisible by $10$} \}$.

Give a regular expression for this language and then a generalized regular expression that is shorter than the regular expression.

1

There are 1 best solutions below

0
On

HINT: Every integer $n\ge 0$ can be written uniquely in the form $n=10q+r$, where $q$ and $r$ are non-negative integers, and $r<10$. If $n\ge 0$, the word $z^n$ is therefore $z^{10q+r}=z^{10q}z^r=(z^{10})^qz^r$.