Suppose there is a finite set $A$ containing $n$ elements. One can construct a sequence of finite length:

$$\{a_i\},\ a_i \in A,\ i\in \mathbb N,\ i\le N$$

This sequence contains $2^N$ subsequences of the form:

$$\{ a_{i_k}\}, k\in \mathbb N,\ k\le M\le N,\ i_k>i_{k-1}$$

Such a subsequence is palindromic iff $a_{i_{M+1-k}} = a_{i_k}\ \forall k$. The length of the longest such palindromic subsequence can thus be defined as:

$$M_p\{a_i\} = \max\{|\{a_{i_k}\}|:a_{i_{M+1-k}} = a_{i_k}\ \forall k\}$$

The algorithm to find $M_p$ is a well known dynamic programming problem, but after implementing it I found an interesting behavior. The average proportional length of the longest palindromic subsequence can be written as:

$$\pi(N) = \left\langle\frac{M_p\{a_i\}}{N}\right\rangle$$

where $\left\langle\right\rangle$ denotes an average over all $\{a_i\}$ of length $N$. In principle, a random sampling should provide a good approximation. Numerically, it appears that $\lim_{N\to\infty}\pi(N)$ converges to a constant depending only on the $n$, the number of elements from which the sequence is constructed. For binary sequences, this limit appears to be $\approx 0.8$, while for $n=10$, it appears to be $\approx 0.45$.

The fact that the limit converges to a constant other than $1$ or $0$ indicates that the longest palindrome scales linearly with the length of the sequence, and that the calculated values appear to be rational numbers quite curious.

Here are some rough approximations of $\lim_{N\to\infty}\pi_n(N)$, generated using 256 random sequences of length 256. $\sigma$ indicates the standard deviation of the distribution, not the sample mean.

\begin{array}{c|lcr} n & \pi_n(N) & \sigma \\ \hline 2 & 0.80035 & 0.01647 \\ 3 & 0.70724 & 0.01615 \\ 4 & 0.64514 & 0.01544 \\ 5 & 0.59718 & 0.01697 \\ 6 & 0.56046 & 0.01617 \\ 7 & 0.53024 & 0.01627 \\ 8 & 0.50377 & 0.01527 \\ 9 & 0.48380 & 0.01520 \\ 10 & 0.46349 & 0.01489 \end{array}

I would like to know if there is a way to derive the asymptotic behavior observed in these numerical results. The complexity of the algorithm for $M_p$ makes it difficult to derive a probability distribution, and the rational number results hint that there may be a simpler approach. Any input would be appreciated.