\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amssymb,amsthm,hyperref}
\newtheorem*{theorem}{Theorem}
\newcommand{\Pal}{\mathcal P}
\title{Distinct palindromic subsequences of binary words}
\author{}\date{28 November 2026}
\begin{document}\maketitle
For a binary word $w$, let $\Pal(w)$ be the set of distinct nonempty palindromes obtainable by deleting positions of $w$. Define $A(n)=\max_{|w|=n}|\Pal(w)|$. This is the definition in \href{https://oeis.org/A306473}{OEIS A306473}. Its displayed table first fails at $n=3$, since $010$ contains $0,1,00,010$. Its example at $n=4$ also omits $00$ from the six distinct palindromes of $0110$.

\begin{theorem}
An alternating binary word of length $n$ attains $A(n)$ for every $n\ge0$. The initial values are $0,1,2,4$ and
\[
 A(n+4)=4+A(n+2)+A(n)\qquad(n\ge0).
\]
Consequently the ordinary generating function is
\[
 \sum_{n\ge0} A(n)x^n=\frac{x+x^2+x^3+x^4}{(1-x)(1-x^2-x^4)}.
\]
Barker's homogeneous recurrence in the entry holds from $n=5$. His proposed generating function has the wrong coefficient in degree three.
\end{theorem}
\begin{proof}
Let $M$ be defined by the initial values and the recurrence in the theorem. Induction gives $2M(j+1)\le M(j)+M(j+2)$, with equality for even $j$. Indeed the second differences $D(j)=M(j+2)-2M(j+1)+M(j)$ satisfy $D(j+4)=D(j+2)+D(j)$ and begin $0,1,0,1$.

For a symbol $a$, every palindrome with outer symbol $a$ is either the singleton $a$, the pair $aa$, or $ava$ for a nonempty palindrome $v$. When the two outer occurrences come from opposite ends of a segment containing $u$ in its interior, that segment supplies exactly $2+|\Pal(u)|$ choices with those two occurrences available. The two symbols give disjoint sets of palindromes.

Consider an arbitrary word of length $j+4$, written $abucd$ with $|u|=j$. If $d=a$, the interior of any palindrome with outer symbol $a$ embeds in $buc$. Both outer occurrences of the other symbol must lie in $buc$, so its interior embeds in $u$. Thus $|\Pal(abuca)|\le 4+|\Pal(buc)|+|\Pal(u)|$. If $d\ne a$, a palindrome with outer symbol $a$ must end before the last letter and its interior embeds in $bu$. A palindrome with outer symbol $d$ starts after the first letter and its interior embeds in $uc$. These give the bound $4+|\Pal(bu)|+|\Pal(uc)|$. Induction and the second-difference inequality bound both cases by $M(j+4)$.

For an alternating word of odd length $j+4$, the two endpoint symbols agree and the next pair of symbols at either end also agree. Every palindrome from either of the indicated alternating interiors can therefore be wrapped with its designated symbol, and the first bound is attained. For an alternating word of even length, the two endpoint symbols differ. The positions from the first through the penultimate letter supply both ends of one symbol, and the positions from the second through the last letter supply the other symbol. This attains $4+2M(j+1)=M(j+4)$ because $j$ is even. Direct counting supplies the four initial cases. Multiplication of the resulting series by $(1-x)(1-x^2-x^4)$ yields the stated numerator.
\end{proof}

\paragraph{Prior work.} Mahalingam and Pandoh study scattered palindromes and give an exact expression when the number of distinct letters is at least half the length. Their Table~4 reports the fixed-binary maxima through length ten. Their Conjecture 5.6 maximizes over varying alphabet sizes. The public resolution of that conjecture concerns the same unrestricted-alphabet maximum. The corrected numbers here coincide, after shifting the index, with \href{https://oeis.org/A238374}{A238374}, whose 2014 definition uses row sums of a Fibonacci matrix and whose entry already gives the generating function. The additional result here is the interpretation by extremal binary words and the alternating extremizer. See \href{https://arxiv.org/abs/2108.02729}{Mahalingam and Pandoh} and the \href{https://www.trureturing.org/research/mahalingam-pandoh-2021-scattered-palindrome-maximum/}{unrestricted-alphabet certificate}.
\end{document}
