Regularity of infinite concatenation It is well-known that an infinite union of regular languages is not necessarily regular, since every language can be written as a union of singletons. What about infinite concatenations?

Let $\{ L_z : z \in \mathbb{Z} \}$ be a family of languages, cofinitely many of which contain $\epsilon$. We can define the infinite concatenation of the family as the collection of all words of the form $w_{i_1} \ldots w_{i_n}$, where $i_1 &lt; \cdots &lt; i_n$ and $w_{i_j} \in L_{i_j}$. (The definition makes sense if we replace $\mathbb{Z}$ with any linear order.)


  Is the infinite concatenation of a family of regular languages necessarily regular?
The answer is negative. Let $L_n = \{\epsilon, a^{3^n}\}$ for $n \geq 0$, and let $L_n = \{\epsilon\}$ for $n &lt; 0$. The infinite concatenation of the collection $\{ L_n : n \in \mathbb{Z} \}$ is
$$
L = \{ a^m : \text{$m$ is the sum of distinct powers of $3$} \}.
$$
Since $L$ is unary, in order to show that $L$ is not regular, we need to show that the set $S = \{ m : \text{$m$ is the sum of distinct powers of $3$} \}$ is not eventually periodic. We can see this in many ways. For example, $S$ is infinite but has density $0$ in the limit.