Optimal regular expressions for palindromes of given length
The language P_n (P̃_n, respectively) consists of all words that are palindromes of length 2n (2n-1, respectively) over a fixed binary alphabet. We construct a regular expression that specifies P_n (P̃_n, respectively) of alphabetic width 4⋅ 2ⁿ-4 (3⋅ 2ⁿ-4, respectively) and show that this is optimal, that is, the expression has minimum alphabetic width among all expressions that describe P_n (P̃_n, respectively). To this end we give optimal expressions for the first k palindromes in lexicographic order of odd and even length, proving that the optimal bound is 2n+4(k-1)-2 S₂(k-1) in case of odd length and 2n+3(k-1)-2 S₂(k-1)-1 for even length, respectively. Here S₂(n) refers to the Hamming weight function, which denotes the number of ones in the binary expansion of the number n.
Authors
- Markus Holzer (ORCID: https://orcid.org/0000-0003-4224-4014)
- Hermann Gruber (ORCID: https://orcid.org/0000-0002-1953-3697)
Institutions
- Justus-Liebig-Universität Gießen (DE)
- Giessen School of Theology (DE)
Publication Details
- Journal
- Information and Computation
- Published
- 2026-04-12
- DOI
- https://doi.org/10.1016/j.ic.2026.105449
- Primary Topic
- Coding theory and cryptography
- Type
- article
- Field-Weighted Citation Impact
- 0.00