Counting distinct border sequences of binary strings

Revision en1, by SydneySweeneyFan, 2025-12-22 09:13:55

I am exploring the following combinatorial question about binary strings and would like insights, ideas, or references from the community.

For a binary string S of length N, define its border sequence as the strictly increasing sequence of integers x (1 ≤ x ≤ N) such that the prefix of S of length x equals the suffix of S of length x.

Formally: x is in the sequence if S[1..x] = S[N−x+1..N]

Note that x = N is always included.

Example: S = "01010" (N = 5) Border sequence = (1, 3, 5)

Now define f(N) as the number of distinct border sequences that occur among all binary strings of length N. We count only unique sequences, not strings.

https://oeis.org/A005434

Is there an optimal way to find this for given N rather than brute enumeration?

Tags string

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English SydneySweeneyFan 2025-12-22 09:13:55 824 Initial revision (published)