OFFSET
0,2
COMMENTS
Following the notation in Gruber/Holzer (2021), for n >= 0 and 1 <= k <= 2^n, let P_{n,k} denote the set containing the lexicographically first k palindromes of even length 2n over the binary alphabet {a,b}. T(n,k) is the minimum number of alphabetic symbols in any regular expression describing the set P_{n,k}.
LINKS
Hermann Gruber and Markus Holzer, Optimal Regular Expressions for Palindromes of Given Length, Proceedings of the 46th International Symposium on Mathematical Foundations of Computer Science, Article No. 53, pp. 53:1-53:15, 2021.
FORMULA
T(n,k) = 2*n + 4*(k-1) - 2*wt(k-1), where wt(n) = A000120(n) is the sum of the binary digits of n. [Gruber and Holzer theorem 14]
EXAMPLE
Triangle T(n,k) begins:
k=1 2 3 4 5 6 ...
n=0: 0,
n=1: 2, 4;
n=2: 4, 6, 10, 12;
n=3: 6, 8, 12, 14, 20, 22, 26, 28;
n=4: 8, 10, 14, 16, 22, 24, 28, 30, 38, 40, 44, 46, 52, 54, 58, 60;
...
MATHEMATICA
Flatten[Table[2n+4(k-1)-2Total[IntegerDigits[k-1, 2]], {n, 0, 6}, {k, 2^n}]] (* Stefano Spezia, Feb 13 2022 *)
CROSSREFS
KEYWORD
nonn,easy,tabf
AUTHOR
Hermann Gruber, Feb 12 2022
STATUS
approved