OFFSET
1,6
COMMENTS
A word l_0...l_n is called a palindrome if l_i = l_{n-i} for all i <= n.
A binary word l_0...l_n is called an antipalindrome if l_i <> l_{n-i} for all i <= n.
LINKS
Sean A. Irvine, Java program (github).
I. Protasov, Palindromial equivalence: one theorem and two problems, Matem. Studii, 14, #1, (2000), p. 111.
O. V. Ravsky, A New Measure of Asymmetry of Binary Words, Journal of Automata, Languages and Combinatorics, 8, #1 (2003), p. 75-83.
FORMULA
a(n) >= floor((n+2*floor((n-3)/7))/3) for every n and for 2 <= n <= 35 equality holds.
PROG
(Python)
from itertools import product
from functools import lru_cache
def ispal(w): return all(w[i] == w[-1-i] for i in range(len(w)//2+1))
def isantipal(w): return all(w[i] != w[-1-i] for i in range(len(w)//2+1))
@lru_cache(maxsize=None)
def d(w): # min deletions needed to transform w into a pal or antipal
if ispal(w) or isantipal(w): return 0
ch = set(w[:i] + w[i+1:] for i in range(len(w)))
return 1 + min(d(wc) for wc in ch)
def a(n): return max(d("0"+"".join(w)) for w in product("01", repeat=n-1))
print([a(n) for n in range(1, 18)]) # Michael S. Branicky, Jul 25 2022
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Sasha Ravsky (oravsky(AT)mail.ru), Jan 12 2004
EXTENSIONS
a(21)-a(35) from Sean A. Irvine, Jul 15 2022
STATUS
approved