Longest Unbordered Factor Problem
- The Longest Unbordered Factor Problem is defined as finding the maximum length of a substring without a proper border, highlighting key concepts in string periodicity and combinatorics.
- It underpins various algorithmic strategies such as KMP-style border arrays, quasilinear LUF array computation, and adaptations for run-length encoded compressed strings.
- Average-case analysis shows that for random strings, the maximal unbordered factor nearly spans the entire string, linking enumeration, automata theory, and efficient string processing.
Searching arXiv for recent and foundational papers on the Longest Unbordered Factor Problem. The Longest Unbordered Factor Problem asks, for a given string , for the maximum length of a factor of that is unbordered, and often also for a factor attaining that maximum. If denotes the maximum length of an unbordered factor, then any factor of length is a maximal unbordered factor (Cording et al., 2017). The problem lies at the intersection of combinatorics on words, periodicity, and string algorithms. It is closely tied to border structure, shortest periods, and the decomposition of strings into unbordered components, and it has been studied in worst-case, average-case, automatic-sequence, and compressed-string settings (Cording et al., 2017, Kociumaka et al., 2018, Sekizaki et al., 22 Jul 2025).
1. Definitions and formal setting
A border of a string is a non-empty proper prefix that is also a suffix (Gabric, 2023, Cording et al., 2017, Sekizaki et al., 22 Jul 2025). Equivalently, a string has a border of length , , iff
A string is unbordered if it has no proper border (Cording et al., 2017). A factor is a contiguous substring; for , denotes the factor 0 (Cording et al., 2017). The quantity
1
denotes the maximum length of an unbordered factor of 2, and any unbordered factor of that length is called a maximal unbordered factor (Cording et al., 2017).
The problem is sometimes formulated globally and sometimes positionally. In the global formulation, the goal is to compute a longest unbordered factor of the input string (Sekizaki et al., 22 Jul 2025). In the positional formulation, the goal is to compute, for every starting position 3, the length of the longest unbordered factor starting at 4. This yields the Longest Unbordered Factor Array
5
with global optimum
6
This stronger array problem was the focus of the quasilinear algorithm of Kociumaka et al. (Kociumaka et al., 2018).
Borders and periods are equivalent in the standard way. An integer 7 is a period of 8 if
9
The shortest period is denoted 0 (Cording et al., 2017). A border of length 1 corresponds to period 2, so a string is unbordered iff its minimum period is its full length (Cording et al., 2017, Kociumaka et al., 2018). This duality is fundamental throughout the literature.
2. Structural combinatorics of borders and unbordered factors
Several structural facts about borders are central to LUF reasoning. A useful representation is the Prefix Border Array, denoted 3, where
4
In particular,
5
This makes unborderedness equivalent to zero longest proper border length (Gabric, 2023).
Two combinatorial lemmas are especially important. First, if 6 is bordered and 7 is a border of 8, then 9 is the shortest border of 0 if and only if 1 is unbordered (Gabric, 2023). Thus every bordered word has a minimal border, and that minimal border is necessarily unbordered. Second, if 2 is the shortest border of a length-3 bordered word 4, then
5
If the shortest border were longer than 6, the overlap of its prefix and suffix occurrences would force 7 itself to be bordered, contradicting the previous lemma (Gabric, 2023). This half-length property is a basic pruning principle: any bordered candidate factor has an unbordered border witness of length at most half its length.
The same phenomenon appears in the probabilistic analysis of random strings. If 8 denotes the length of the shortest border, then
9
because any border of length 0 induces a shorter border of length 1 (Cording et al., 2017). This observation underlies both combinatorial and average-case arguments.
The literature also relates maximal unbordered factors to minimal period. If 2 denotes the length of the maximal unbordered factor and 3 the minimal period, then Ehrenfeucht and Silberger showed that if the minimal period of 4 is 5, then
6
However, the converse regime is subtler. Assous and Pouzet gave a counterexample of length
7
for which
8
showing that 9 and 0 need not coincide even when 1 (Kucherov et al., 2015). Holub and Nowotka later showed that if
2
then
3
and that this bound is tight (Kucherov et al., 2015). This rules out a simplistic identification of LUF length with shortest period in general.
3. Algorithmic foundations and worst-case complexity
A direct algorithmic primitive is border computation via KMP-style arrays. For a word 4, the unbordered prefix indicator 5, defined by
6
can be computed in 7 time by computing 8 and testing 9 (Gabric, 2023). Likewise, the full border indicator of a word can be computed in 0 time (Gabric, 2023). These are foundational tools for LUF-style algorithms, because they reduce border questions to linear-time prefix-function and border-chain computations.
A straightforward baseline algorithm computes, for every suffix 1, its border array; prefixes with border-array value 2 are exactly unbordered prefixes, so scanning all suffixes inspects all factors. This yields 3 time (Kucherov et al., 2015). The same paper proposed a deterministic modification: process suffixes from longest to shortest, maintain the best MUF length 4, and stop once the current suffix length is at most 5. For a string 6, this runs in
7
where 8 is the length of the maximal unbordered factor (Kucherov et al., 2015).
The first substantial worst-case improvement before quasilinear time was the 9-time method of Gawrychowski et al., cited as the previous best worst-case algorithm on integer alphabets (Kociumaka et al., 2018). Kociumaka et al. then gave the first quasilinear algorithm for the Longest Unbordered Factor Array on general alphabets: 0 and deterministically
1
This computes the entire 2 array, not merely the global optimum (Kociumaka et al., 2018).
The algorithmic framework uses the Longest Successor Factor arrays. For each position 3,
4
is the length of the longest factor starting at 5 that occurs again somewhere to its right, and
6
is the position of the last occurrence of that factor (Kociumaka et al., 2018). The algorithm processes positions from right to left and splits into three cases: positions with no successor repetition, positions whose repeated part is shorter than the longest unbordered factor at the referred position, and a hard case resolved through the notion of a hook (Kociumaka et al., 2018).
For a position 7, the hook 8 is the smallest position 9 such that 0 can be decomposed into unbordered prefixes of 1 (Kociumaka et al., 2018). In the hard case,
2
The efficiency comes from combining this combinatorial description with prefix-suffix query data structures and a stack-based memoization of partial hook information. The resulting total hook work is 3, and the algorithm’s 4 upper bound is tight for its stack-size analysis on an infinite family of binary words (Kociumaka et al., 2018).
The main open worst-case question remains whether LUF can be solved in 5 time on ordinary strings. The compressed-string literature makes explicit that the true open problem is whether LUF can be solved in 6 time on plain strings (Sekizaki et al., 22 Jul 2025).
4. Average-case theory and relation to shortest period
Average-case analysis for uniformly random strings has been especially successful. Loptev, Kucherov, and Starikovskaya proved a lower bound implying that for large alphabets the expected maximum unbordered-factor length is close to 7, and conjectured
8
for a uniformly random string over a fixed non-unary alphabet (Cording et al., 2017). That conjecture was later confirmed and sharpened: for a uniformly random length-9 string over a fixed alphabet 0 of size 1,
2
with the theorem stated in the paper as
3
and with the abstract giving the final asymptotic as 4 (Cording et al., 2017).
The same work establishes concentration. For each 5, the probability of
6
is at least 7 (Cording et al., 2017). Equivalently, the deficiency
8
has an exponentially decaying tail. The proof proceeds by bounding the moment generating function
9
uniformly in 00, conditioning on the shortest border length, and exploiting the impossibility of a shortest border length in 01 (Cording et al., 2017).
These results imply that in a uniformly random string, the longest unbordered factor is typically extremely close to the full string length. They also imply algorithmic consequences. Loptev et al. had an algorithm running in
02
worst-case time, which becomes
03
on average once 04 is known (Cording et al., 2017). More significantly, the same paper establishes an average-case equivalence between computing the LUF length and computing the shortest period. Specifically, it proves:
- The problem of computing 05 can be reduced in 06 expected time to the problem of computing 07 for a fixed factor 08 of 09.
- The problem of computing 10 can be reduced in 11 expected time to the problem of computing 12 (Cording et al., 2017).
Because Czumaj and GÄ…sieniec had proved for shortest-period computation on uniformly random strings the bounds
13
these transfer to maximal unbordered factors (Cording et al., 2017). As a result, the average-case running time for computing a maximal unbordered factor lies in
14
which is substantially below linear (Cording et al., 2017).
Earlier probabilistic work had already shown that the expected MUF length is large. Over an alphabet of size 15, the expected length of the maximal unbordered factor is at least
16
where
17
and for 18,
19
For 20, this yields the corollary
21
for sufficiently large 22 (Kucherov et al., 2015). That lower bound motivated the suffix-border-array early-stopping algorithm, whose expected running time under the uniform distribution over 23 is
24
(Kucherov et al., 2015). Historically, this average-case lower bound preceded the sharper 25 result (Cording et al., 2017).
5. Counting, automata, and combinatorial enumeration
Although not direct LUF algorithms, counting results and enumeration methods illuminate how common unbordered words are and how border structure propagates. Over a 26-letter alphabet, if 27 is the number of unbordered words of length 28, then the number of bordered words is
29
The literature cited in the ranking and unranking work states that Nielsen showed both
30
so a constant fraction of all length-31 words are unbordered, and also a constant fraction are bordered (Gabric, 2023). This helps explain why long unbordered factors are statistically common.
A more refined combinatorial object is
32
the number of length-33 bordered words over 34 having 35 as a prefix. For 36 of length 37, with unbordered prefix indicator 38 and border indicator 39, the recurrence is
40
This recurrence classifies bordered words by the length of their shortest border, using the facts that shortest borders are unbordered and have length at most half (Gabric, 2023). While this is not an LUF algorithm, it gives a structural decomposition directly relevant to border-based pruning arguments.
In automatic-sequence settings, counting methods become automata-theoretic. For the Thue–Morse sequence 41, the number 42 of distinct unbordered factors of length 43 is shown to be a 44-regular sequence with explicit recurrences (Goc et al., 2012). The paper constructs a 23-state automaton accepting pairs 45 such that there is a novel unbordered factor of length 46 beginning at position 47, and then deduces that 48 is 49-regular (Goc et al., 2012). Its main asymptotic theorem states
50
and also
51
with the explicit identity
52
The same work also cites a characterization of existence for Thue–Morse: 53 This does not solve the finite-string LUF problem, but it shows that, in automatic sequences, existence-at-length can be regular in the base-54 representation of the length (Goc et al., 2012). Such results are relevant for bounded-prefix or sequence-specific variants of longest-unbordered-factor questions.
6. Compressed-string variants and run-length encoding
The LUF problem has also been studied in compressed-string processing, particularly for run-length encoded strings. In the RLE model, a string 55 is represented as
56
where each run 57 is a maximal block of identical characters, with uncompressed length
58
and compressed size 59 (Sekizaki et al., 22 Jul 2025). A factor is RLE-bounded if it starts at some run boundary and ends at some run boundary (Sekizaki et al., 22 Jul 2025).
The main structural observation is: 60 Because extending an unbordered factor within a run preserves unborderedness, every longest unbordered factor of a non-unary string can be extended to run boundaries. Consequently, every longest unbordered factor is RLE-bounded (Sekizaki et al., 22 Jul 2025). This is the core compressed-structure theorem in the paper.
Using this reduction, the paper gives an algorithm that, given an RLE encoded string of RLE size 61, computes the set of longest unbordered factors in
62
equivalently
63
This adapts the candidate-elimination strategy of the older 64-time algorithm to the run-length encoded setting (Sekizaki et al., 22 Jul 2025).
The algorithm introduces run-based tools, including the RLE shortest border array
65
computable in
66
(Sekizaki et al., 22 Jul 2025). It partitions the runs into 67 blocks, treats borders of RLE size at most 68 as short, and uses two principal subroutines: one for finding longest unbordered factors of small RLE size and one for generating and then filtering candidates that have no short border but may have a long border (Sekizaki et al., 22 Jul 2025). Long-border filtering relies on an RLE pseudo period
69
where 70 and 71 is the RLE size of the longest border of 72 (Sekizaki et al., 22 Jul 2025).
This compressed result does not improve the worst-case uncompressed bound when 73, since it becomes 74, worse than 75 (Sekizaki et al., 22 Jul 2025). Its significance is instead that it is the first nontrivial LUF algorithm whose complexity is expressed in terms of the RLE size rather than the uncompressed length.
7. Scope, variants, and research directions
The LUF problem has several distinct but related variants. The classical finite-string optimization problem asks for one longest unbordered factor or its length (Cording et al., 2017, Sekizaki et al., 22 Jul 2025). The array variant asks for the longest unbordered factor starting at each position (Kociumaka et al., 2018). Average-case work studies random strings under the uniform distribution over a fixed alphabet (Kucherov et al., 2015, Cording et al., 2017). Automata-theoretic work studies existence and counting for structured infinite words such as Thue–Morse and period-doubling sequences (Goc et al., 2012). Compressed-string work studies the same optimization problem under succinct input models such as RLE (Sekizaki et al., 22 Jul 2025).
A common misconception is to identify longest unbordered factor length with shortest period outright. The literature shows instead a more nuanced relationship: 76 for every string (Cording et al., 2017), the two quantities coincide in certain small-period or small-77 regimes (Kucherov et al., 2015), and in the random-input setting they are equivalent up to very small average-case reduction overheads (Cording et al., 2017). But they are not identical in general, as the Assous–Pouzet counterexample demonstrates (Kucherov et al., 2015).
Another important distinction is between counting and optimization. Enumeration results such as 78, the recurrence for 79, or the 80-regular recurrences for the Thue–Morse counting function 81 do not directly compute LUF on an arbitrary finite input, but they provide structural information about border witnesses, abundance of unbordered words, and regularity phenomena that inform algorithm design (Gabric, 2023, Goc et al., 2012).
The main unresolved algorithmic question highlighted in the literature is whether LUF can be solved in linear time on ordinary strings (Sekizaki et al., 22 Jul 2025). The quasilinear algorithm of Kociumaka et al. remains the benchmark worst-case result on general alphabets (Kociumaka et al., 2018), while the RLE result suggests that compressed representations may admit further specialized advances (Sekizaki et al., 22 Jul 2025). A plausible implication is that progress may continue along two tracks: improved border-sensitive decompositions for the uncompressed problem, and structure-exploiting reductions for compressed or highly repetitive inputs.