Papers
Topics
Authors
Recent
Search
2000 character limit reached

Longest Unbordered Factor Problem

Updated 7 July 2026
  • 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 SS, for the maximum length of a factor of SS that is unbordered, and often also for a factor attaining that maximum. If L(S)L(S) denotes the maximum length of an unbordered factor, then any factor of length L(S)L(S) 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 SS has a border of length ℓ\ell, 1≤ℓ≤n1 \le \ell \le n, iff

S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].

A string is unbordered if it has no proper border (Cording et al., 2017). A factor is a contiguous substring; for 1≤i≤j≤n1 \le i \le j \le n, S[i,j]S[i,j] denotes the factor SS0 (Cording et al., 2017). The quantity

SS1

denotes the maximum length of an unbordered factor of SS2, 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 SS3, the length of the longest unbordered factor starting at SS4. This yields the Longest Unbordered Factor Array

SS5

with global optimum

SS6

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 SS7 is a period of SS8 if

SS9

The shortest period is denoted L(S)L(S)0 (Cording et al., 2017). A border of length L(S)L(S)1 corresponds to period L(S)L(S)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 L(S)L(S)3, where

L(S)L(S)4

In particular,

L(S)L(S)5

This makes unborderedness equivalent to zero longest proper border length (Gabric, 2023).

Two combinatorial lemmas are especially important. First, if L(S)L(S)6 is bordered and L(S)L(S)7 is a border of L(S)L(S)8, then L(S)L(S)9 is the shortest border of L(S)L(S)0 if and only if L(S)L(S)1 is unbordered (Gabric, 2023). Thus every bordered word has a minimal border, and that minimal border is necessarily unbordered. Second, if L(S)L(S)2 is the shortest border of a length-L(S)L(S)3 bordered word L(S)L(S)4, then

L(S)L(S)5

If the shortest border were longer than L(S)L(S)6, the overlap of its prefix and suffix occurrences would force L(S)L(S)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 L(S)L(S)8 denotes the length of the shortest border, then

L(S)L(S)9

because any border of length SS0 induces a shorter border of length SS1 (Cording et al., 2017). This observation underlies both combinatorial and average-case arguments.

The literature also relates maximal unbordered factors to minimal period. If SS2 denotes the length of the maximal unbordered factor and SS3 the minimal period, then Ehrenfeucht and Silberger showed that if the minimal period of SS4 is SS5, then

SS6

However, the converse regime is subtler. Assous and Pouzet gave a counterexample of length

SS7

for which

SS8

showing that SS9 and â„“\ell0 need not coincide even when â„“\ell1 (Kucherov et al., 2015). Holub and Nowotka later showed that if

â„“\ell2

then

â„“\ell3

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 â„“\ell4, the unbordered prefix indicator â„“\ell5, defined by

â„“\ell6

can be computed in ℓ\ell7 time by computing ℓ\ell8 and testing ℓ\ell9 (Gabric, 2023). Likewise, the full border indicator of a word can be computed in 1≤ℓ≤n1 \le \ell \le n0 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≤ℓ≤n1 \le \ell \le n1, its border array; prefixes with border-array value 1≤ℓ≤n1 \le \ell \le n2 are exactly unbordered prefixes, so scanning all suffixes inspects all factors. This yields 1≤ℓ≤n1 \le \ell \le n3 time (Kucherov et al., 2015). The same paper proposed a deterministic modification: process suffixes from longest to shortest, maintain the best MUF length 1≤ℓ≤n1 \le \ell \le n4, and stop once the current suffix length is at most 1≤ℓ≤n1 \le \ell \le n5. For a string 1≤ℓ≤n1 \le \ell \le n6, this runs in

1≤ℓ≤n1 \le \ell \le n7

where 1≤ℓ≤n1 \le \ell \le n8 is the length of the maximal unbordered factor (Kucherov et al., 2015).

The first substantial worst-case improvement before quasilinear time was the 1≤ℓ≤n1 \le \ell \le n9-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: S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].0 and deterministically

S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].1

This computes the entire S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].2 array, not merely the global optimum (Kociumaka et al., 2018).

The algorithmic framework uses the Longest Successor Factor arrays. For each position S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].3,

S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].4

is the length of the longest factor starting at S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].5 that occurs again somewhere to its right, and

S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].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 S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].7, the hook S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].8 is the smallest position S[1,ℓ]=S[n−ℓ+1,n].S[1,\ell]=S[n-\ell+1,n].9 such that 1≤i≤j≤n1 \le i \le j \le n0 can be decomposed into unbordered prefixes of 1≤i≤j≤n1 \le i \le j \le n1 (Kociumaka et al., 2018). In the hard case,

1≤i≤j≤n1 \le i \le j \le n2

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 1≤i≤j≤n1 \le i \le j \le n3, and the algorithm’s 1≤i≤j≤n1 \le i \le j \le n4 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 1≤i≤j≤n1 \le i \le j \le n5 time on ordinary strings. The compressed-string literature makes explicit that the true open problem is whether LUF can be solved in 1≤i≤j≤n1 \le i \le j \le n6 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 1≤i≤j≤n1 \le i \le j \le n7, and conjectured

1≤i≤j≤n1 \le i \le j \le n8

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-1≤i≤j≤n1 \le i \le j \le n9 string over a fixed alphabet S[i,j]S[i,j]0 of size S[i,j]S[i,j]1,

S[i,j]S[i,j]2

with the theorem stated in the paper as

S[i,j]S[i,j]3

and with the abstract giving the final asymptotic as S[i,j]S[i,j]4 (Cording et al., 2017).

The same work establishes concentration. For each S[i,j]S[i,j]5, the probability of

S[i,j]S[i,j]6

is at least S[i,j]S[i,j]7 (Cording et al., 2017). Equivalently, the deficiency

S[i,j]S[i,j]8

has an exponentially decaying tail. The proof proceeds by bounding the moment generating function

S[i,j]S[i,j]9

uniformly in SS00, conditioning on the shortest border length, and exploiting the impossibility of a shortest border length in SS01 (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

SS02

worst-case time, which becomes

SS03

on average once SS04 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:

  1. The problem of computing SS05 can be reduced in SS06 expected time to the problem of computing SS07 for a fixed factor SS08 of SS09.
  2. The problem of computing SS10 can be reduced in SS11 expected time to the problem of computing SS12 (Cording et al., 2017).

Because Czumaj and GÄ…sieniec had proved for shortest-period computation on uniformly random strings the bounds

SS13

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

SS14

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 SS15, the expected length of the maximal unbordered factor is at least

SS16

where

SS17

and for SS18,

SS19

For SS20, this yields the corollary

SS21

for sufficiently large SS22 (Kucherov et al., 2015). That lower bound motivated the suffix-border-array early-stopping algorithm, whose expected running time under the uniform distribution over SS23 is

SS24

(Kucherov et al., 2015). Historically, this average-case lower bound preceded the sharper SS25 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 SS26-letter alphabet, if SS27 is the number of unbordered words of length SS28, then the number of bordered words is

SS29

The literature cited in the ranking and unranking work states that Nielsen showed both

SS30

so a constant fraction of all length-SS31 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

SS32

the number of length-SS33 bordered words over SS34 having SS35 as a prefix. For SS36 of length SS37, with unbordered prefix indicator SS38 and border indicator SS39, the recurrence is

SS40

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 SS41, the number SS42 of distinct unbordered factors of length SS43 is shown to be a SS44-regular sequence with explicit recurrences (Goc et al., 2012). The paper constructs a 23-state automaton accepting pairs SS45 such that there is a novel unbordered factor of length SS46 beginning at position SS47, and then deduces that SS48 is SS49-regular (Goc et al., 2012). Its main asymptotic theorem states

SS50

and also

SS51

with the explicit identity

SS52

(Goc et al., 2012).

The same work also cites a characterization of existence for Thue–Morse: SS53 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-SS54 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 SS55 is represented as

SS56

where each run SS57 is a maximal block of identical characters, with uncompressed length

SS58

and compressed size SS59 (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: SS60 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 SS61, computes the set of longest unbordered factors in

SS62

equivalently

SS63

This adapts the candidate-elimination strategy of the older SS64-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

SS65

computable in

SS66

(Sekizaki et al., 22 Jul 2025). It partitions the runs into SS67 blocks, treats borders of RLE size at most SS68 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

SS69

where SS70 and SS71 is the RLE size of the longest border of SS72 (Sekizaki et al., 22 Jul 2025).

This compressed result does not improve the worst-case uncompressed bound when SS73, since it becomes SS74, worse than SS75 (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: SS76 for every string (Cording et al., 2017), the two quantities coincide in certain small-period or small-SS77 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 SS78, the recurrence for SS79, or the SS80-regular recurrences for the Thue–Morse counting function SS81 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.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Longest Unbordered Factor Problem.