May 31, 2026
The Burrows–Wheeler transform is usually viewed as a clustering transform: it tends to group equal letters into long runs. We study the opposite extremal regime, where the BWT output is completely unclustered, that is, has as many equal-letter runs as positions. Known results imply, on the one hand, that the number of runs in the BWT of a Lyndon word can increase by at most a factor of two, and, on the other hand, that over every alphabet of size at least three completely unclustered BWT images exist in every length. This leads to the extremal problem lying between these two facts. For \(k\ge3\), let \(U_k(n)\) be the minimum cyclic run number of a primitive necklace of length \(n\) whose BWT has \(n\) runs.
We prove the universal lower bound \(U_k(n)\ge\lceil n/2\rceil\), reduce the sharpness problem for one-cycle BWT images \(L\) to the Hamming identity \[\rho_{\circ}(\operatorname{BWT}^{-1}(L))=d_{\mathrm H}(L,\operatorname{sort}(L)),\] and develop a natural multiset-of-necklaces relaxation with an explicit constant-cycle correction. We compute the small values, including the exceptional value \(U_k(6)=4\), prove a parity obstruction for the Parikh vectors of sharp examples, and determine the multiset relaxation exactly. Finally, for every prime \(p\equiv5\pmod8\) for which \(2\) is a primitive root modulo \(p\), we prove sharpness in the adjacent lengths \(p-1\) and \(p\). Under the corresponding Artin-type infinitude hypothesis, this gives infinitely many adjacent sharp pairs.
Run-length compression of the Burrows–Wheeler transform (BWT) [1] exploits a basic clustering effect: after sorting contexts, equal letters often become grouped into long runs. This paper studies the opposite extremal regime, in which the BWT output is completely unclustered.
A factor-two theorem of Mantaci et al. [2] shows that this opposite behaviour is universally bounded: for every Lyndon word \(w\), \[\label{eq:MRRSV-bound} \rho(\operatorname{BWT}(w))\le 2\rho(w).\tag{1}\] Moreover, the factor \(2\) is sharp, and the binary case of maximal unclustering is governed by primitive-root arithmetic.
A recent theorem of Fici et al. [3] gives a complementary existence result. For every integer \(n>0\) and every alphabet size \(k\ge3\), there exists a primitive necklace \([u]\) of length \(n\) over \(\Sigma_k\) whose BWT is completely unclustered: \[\rho(\operatorname{BWT}([u]))=n.\] Their proof proceeds through generalized de Bruijn words and then uses insertion/deletion operations preserving the cyclicity of the standard permutation. For the generalized de Bruijn viewpoint on BWT and standard permutations, see also Fici–Gabory [4].
These two results leave a natural joint extremal problem. Inequality 1 implies that if \(\operatorname{BWT}([u])\) has \(n\) runs, then the input necklace must have at least \(\lceil n/2\rceil\) cyclic runs. The existence theorem of [3] shows that BWT outputs with \(n\) runs exist in every length over non-binary alphabets. The missing question is whether the two extremal behaviours can occur simultaneously: \[\rho(\operatorname{BWT}([u]))=n, \qquad \rho_{\circ}([u])\approx n/2.\] We investigate this extremal question in the present paper.
Our main contributions are:
we introduce \(U_k(n)\) and prove the universal lower bound \(U_k(n)\ge\lceil n/2\rceil\);
we reduce the one-cycle sharpness problem to an explicit Hamming-distance criterion;
we compute the first small values, including the exceptional value \(U_k(6)=4\);
we construct Artin-type sharp families in the adjacent lengths \(p-1\) and \(p\);
we prove a parity obstruction for the Parikh vectors of sharp examples;
we determine the associated multiset-of-necklaces relaxation exactly.
Fix an ordered alphabet \[\Sigma_k=\{0<1<\cdots<k-1\}.\] For a word \(w=w_0w_1\cdots w_{n-1}\in\Sigma_k^n\), its ordinary, linear number of equal-letter runs is \[\rho(w)= \begin{cases} 0,& n=0,\\ 1+\#\{0\le i<n-1: w_i\ne w_{i+1}\},& n>0. \end{cases}\]
Throughout the paper, positions in words of length \(n\) are indexed from \(0\) to \(n-1\). For a letter \(a\in\Sigma_k\), we write \[|w|_a=\#\{0\le i<n:w_i=a\}\] for the number of occurrences of \(a\) in \(w\). The Parikh vector of \(w\) is \[\operatorname{Parikh}(w)=(|w|_0,\ldots,|w|_{k-1}).\]
A necklace \([w]\) is a conjugacy class of words under cyclic rotation. It is primitive, or aperiodic, if it contains \(n\) distinct conjugates. For a nonconstant necklace we define its cyclic run number by \[\rho_{\circ}([w])= \#\{i\in\mathbb{Z}/n\mathbb{Z}: w_i\ne w_{i+1}\}.\] For a constant necklace we set \(\rho_{\circ}([w])=1\). Equivalently, \[\rho_{\circ}([w])=\min\{\rho(v):v\in[w]\}.\]
Let \([u]\) be a primitive necklace of length \(n\). Its BWT matrix is the matrix whose rows are the \(n\) cyclic shifts of \(u\), sorted lexicographically. The \(\operatorname{BWT}([u])\) is the last column of this matrix. The first column is the sorted word \[F=\operatorname{sort}(L),\qquad L=\operatorname{BWT}([u]).\]
If \(L=L_0L_1\cdots L_{n-1}\), its standard permutation \(\pi_L\) is the stable sorting map from the last column to the first column. More explicitly, if \(L_i=a\) and this is the \(r\)-th occurrence of \(a\) in \(L\), counted from \(0\), then \[\label{eq:standard-permutation} \pi_L(i)=C_a+r, \qquad C_a=\sum_{b<a}|L|_b.\tag{2}\] Thus \(\pi_L(i)\) is the position in \(F\) corresponding to the occurrence \(L_i\). In particular, \[\label{eq:L-F-pi} L_i=F_{\pi_L(i)}.\tag{3}\] A standard criterion says that a word \(L\in\Sigma_k^n\) is the BWT of an aperiodic necklace if and only if \(\pi_L\) is a single cycle of length \(n\); see, e.g., [3], [5], [6].
Definition 1. A word \(L\in\Sigma_k^n\) is called completely unclustered if \(\rho(L)=n.\) Equivalently, \(L_i\ne L_{i+1}\) for all \(0\le i<n-1\). If, in addition, \(\pi_L\) is an \(n\)-cycle, then \(L\) is a completely unclustered BWT image of one primitive necklace.
Definition 2. For \(k\ge3\) and \(n\ge1\), define \[\label{eq:Ukn-def} U_k(n)=\min\left\{\rho_{\circ}([u]): [u]\text{ is a primitive necklace over }\Sigma_k,\; |u|=n,\; \rho(\operatorname{BWT}([u]))=n \right\}.\tag{4}\]
The function \(U_k(n)\) measures the smallest possible cyclic run-complexity of an input primitive necklace of length \(n\) whose BWT is as unclustered as possible. Equivalently, it asks how clustered the input can still be if the BWT output has the maximum possible number \(n\) of equal-letter runs. Thus \(U_k(n)=\lceil n/2\rceil\) means that the BWT can attain the extremal factor-two run amplification.
For \(k\ge3\), the non-binary existence theorem for completely unclustered BWT images [3] implies that the set in 4 is nonempty for every \(n\). Thus \(U_k(n)\) is finite for all \(n\) and \(k\ge3\).
Proposition 1. For every \(k\ge3\) and every \(n\ge1\), \[\label{eq:lower-bound} U_k(n)\ge \left\lceil\frac{n}{2}\right\rceil.\qquad{(1)}\]
Proof. Let \(w\) be the Lyndon representative of \([u]\). Since BWT is constant on conjugacy classes, \(\rho(\operatorname{BWT}(w))=n\). By [2], \(\rho(\operatorname{BWT}(w))\le 2\rho(w).\) For the Lyndon representative of a primitive necklace, the Lyndon cut occurs at a cyclic run boundary: unless \(|w|=1\), the first letter of \(w\) is strictly smaller than its last letter. Hence \(\rho(w)=\rho_{\circ}([u]).\) Therefore \(n\le 2\rho_{\circ}([u])\), and the claim follows. ◻
Remark 2. For every \(k\ge3\), any ternary example over \(\{0,1,2\}\) is also an example over \(\Sigma_k\). Hence \[U_k(n)\le U_3(n)\qquad(k\ge3).\] Since the lower bound ?? is independent of \(k\), proving a sharp ternary upper bound proves the same formula for all larger alphabets.
The following elementary lemma is the main bookkeeping tool. It turns the extremal problem into a problem about the crossing pattern of a permutation with respect to the ordered intervals of the sorted word \(F\).
Lemma 1. Let \(L\in\Sigma_k^n\), let \(F=\operatorname{sort}(L)\), and let \(\pi=\pi_L\) be the standard permutation. Suppose that \(\pi\) is a single cycle, let \([u]=\operatorname{BWT}^{-1}(L)\), and assume \(n>1\) for the input-run formula below. Then:
\[\rho(L)=1+\#\{0\le i<n-1:F_{\pi(i)}\ne F_{\pi(i+1)}\}.\] In particular, \(L\) is completely unclustered if and only if \[F_{\pi(i)}\ne F_{\pi(i+1)}\qquad(0\le i<n-1).\]
The cyclic input run number is \[\label{eq:input-crossing-formula} \rho_{\circ}([u])= \#\{i\in\{0,\ldots,n-1\}:F_i\ne F_{\pi(i)}\}.\tag{5}\]
Proof. Part (a) follows from \(L_i=F_{\pi_L(i)}\). Part (b) is the standard inverse-BWT formula written in the convention where \(\pi_L^{-1}\) is the FL-mapping [2]. ◻
Definition 3 (Crossing number). Let \(F\) be a sorted word and \(\pi\) a permutation of its positions. Define \[\operatorname{cr}_F(\pi)=\#\{i:F_i\ne F_{\pi(i)}\}.\] By Lemma 1, for a BWT image \(L\) with \(F=\operatorname{sort}(L)\), \[\rho_{\circ}(\operatorname{BWT}^{-1}(L))=\operatorname{cr}_F(\pi_L).\]
Proposition 3. Let \(L\in\Sigma_k^n\), let \(F=\operatorname{sort}(L)\), and suppose that \(n>1\) and that the standard permutation \(\pi_L\) is an \(n\)-cycle. Then \[\label{eq:hamming-reduction} \rho_{\circ}(\operatorname{BWT}^{-1}(L)) =d_{\mathrm H}(L,F),\qquad{(2)}\] where \(d_{\mathrm H}\) denotes Hamming distance.
Proof. By the definition of the standard permutation, \(L_i=F_{\pi_L(i)}.\) Therefore Lemma 1 gives \[\rho_{\circ}(\operatorname{BWT}^{-1}(L)) =\#\{i:F_i\ne F_{\pi_L(i)}\} =\#\{i:F_i\ne L_i\} =d_{\mathrm H}(F,L).\] ◻
Corollary 1. Conjecture 10 is equivalent to the following ternary construction problem: for every \(n\ge7\), construct a word \(L_n\in\{0,1,2\}^n\) such that
\(L_{n,i}\ne L_{n,i+1}\) for all \(0\le i<n-1\);
\(\pi_{L_n}\) is an \(n\)-cycle;
\(d_{\mathrm H}(L_n,\operatorname{sort}(L_n))=\lceil n/2\rceil\).
The standard-permutation formulation above is a one-cycle fragment of the classical Gessel–Restivo–Reutenauer bijection [5], which we call the GRR bijection below. Adding this viewpoint is useful for two reasons. First, it embeds the function \(U_k(n)\) into a broader multiset-of-necklaces framework. Second, it provides an exact Parikh-vector baseline count for possible one-cycle BWT images before imposing the completely-unclustered condition.
Let \(L\in\Sigma_k^n\), let \(\pi_L\) be its standard permutation in the convention of 2 , and put \[\tau_L=\pi_L^{-1}.\] Write the disjoint cycle decomposition of \(\tau_L\). If \[C=(i_0,i_1,\ldots,i_{m-1})\] is a cycle, where \(\tau_L(i_j)=i_{j+1}\) cyclically, associate to it the necklace \[N_C=[L_{i_0}L_{i_1}\cdots L_{i_{m-1}}].\] The GRR map sends \[L\longmapsto \Phi(L):=\{N_C:C\in\operatorname{Cyc}(\tau_L)\},\] a multiset of primitive necklaces. With the above convention one uses the inverse standard permutation; using the standard permutation instead gives the same cycle type and an equivalent convention. The GRR theorem states that \(\Phi\) is a bijection from words of length \(n\) over the ordered alphabet to multisets of primitive necklaces of total length \(n\), preserving the Parikh vector and the cycle type. The usual BWT of one primitive necklace is precisely the inverse map restricted to multisets consisting of a single necklace [5].
Definition 4 (GRR total run number). For \(L\in\Sigma_k^n\), define \[R_{\operatorname{GRR}}(L)=\sum_{C\in\operatorname{Cyc}(\tau_L)}\rho_{\circ}(N_C), \qquad \tau_L=\pi_L^{-1}.\]
Proposition 4. Let \(L\in\Sigma_k^n\), let \(F=\operatorname{sort}(L)\), and put \(\tau_L=\pi_L^{-1}\). A cycle \(C\in\operatorname{Cyc}(\tau_L)\) will be called letter-constant* if all letters \(L_i\), \(i\in C\), are equal. Let \[c_0(L)=\#\{C\in\operatorname{Cyc}(\tau_L): C\text{ is letter-constant}\}.\] Then \[\label{eq:grr-hamming-correction} R_{\operatorname{GRR}}(L)=d_{\mathrm H}(L,F)+c_0(L).\tag{6}\] In particular, in the one-cycle nonconstant case the correction term is zero, and 6 reduces to \(R_{\operatorname{GRR}}(L)=d_{\mathrm H}(L,\operatorname{sort}(L))\).*
Proof. For a cycle \(C\) of \(\tau_L\), the cyclic run number of the associated necklace is the number of colour changes along the cycle, except in the letter-constant case, where our convention gives one cyclic run rather than zero. Hence \[R_{\operatorname{GRR}}(L)= \#\{i:L_i\ne L_{\tau_L(i)}\}+c_0(L).\] Since \(L_i=F_{\pi_L(i)}\) and \(\tau_L=\pi_L^{-1}\), we have \[L_i\ne L_{\tau_L(i)} \Longleftrightarrow F_{\pi_L(i)}\ne F_i.\] Therefore \[\#\{i:L_i\ne L_{\tau_L(i)}\} =\#\{i:F_i\ne F_{\pi_L(i)}\} =\#\{i:F_i\ne L_i\} =d_{\mathrm H}(F,L),\] which proves the formula. ◻
Remark 5. The correction term in Proposition 4 is essential. For instance, for \(L=01\) one has \(d_{\mathrm H}(L,\operatorname{sort}(L))=0\), while the GRR multiset consists of two one-letter necklaces and hence \(R_{\operatorname{GRR}}(L)=2\). Thus the GRR relaxation cannot be analysed by Hamming distance alone; constant cycles must be counted separately.
This suggests a relaxed version of the extremal function in which the inverse object is allowed to be a multiset of necklaces rather than one necklace.
Definition 5 (GRR multiset relaxation). For \(k\ge3\), define \[\widetilde{U}_k(n)= \min\{R_{\operatorname{GRR}}(L):L\in\Sigma_k^n,\;\rho(L)=n\}.\]
Since every completely unclustered one-cycle BWT image \(L\) is also an admissible word in the GRR relaxation, and in the one-cycle case \(R_{\operatorname{GRR}}(L)=\rho_{\circ}(\operatorname{BWT}^{-1}(L))\), we immediately have \[\widetilde{U}_k(n)\le U_k(n).\] Thus the original problem is the one-cycle refinement of a natural GRR multiset minimization problem.
We shall determine \(\widetilde{U}_k(n)\) exactly in Theorem 16. The remaining issue is whether a minimizing GRR multiset can be represented by a single standard cycle.
Proposition 4 shows that this relaxation is still not merely a Hamming-distance minimization problem. Any possible gap between \(\widetilde{U}_k(n)\) and \(U_k(n)\) must take into account both crossing edges and letter-constant GRR cycles. Thus the multiset relaxation is useful as a structural comparison, but it does not by itself prove or disprove the sharp one-cycle conjecture.
Let \[\alpha=(\alpha_0,\ldots,\alpha_{k-1}),\qquad |\alpha|=\sum_a\alpha_a=n,\] be a Parikh vector. Let \(B_k(\alpha)\) denote the number of words \(L\in\Sigma_k^n\) with Parikh vector \(\alpha\) such that \(\pi_L\) is a single cycle. Equivalently, \(B_k(\alpha)\) counts BWT images of primitive necklaces with Parikh vector \(\alpha\). This count does not impose the condition \(\rho(L)=n\); it is a baseline count before the unclustered restriction.
Proposition 6. Let \(\alpha=(\alpha_0,\ldots,\alpha_{k-1})\) be a Parikh vector of total size \(n\). Then \[\label{eq:parikh-baseline} B_k(\alpha)= \frac{1}{n} \sum_{d\mid \gcd(\alpha_0,\ldots,\alpha_{k-1})} \mu(d) \binom{n/d}{\alpha_0/d,\ldots,\alpha_{k-1}/d},\qquad{(3)}\] where zeros among the \(\alpha_a\)’s are allowed and the divisibility condition means that \(d\) divides every nonzero \(\alpha_a\).
Proof. This is the classical fixed-content formula for primitive necklaces, applied through the one-cycle case of the GRR bijection [5], [7]. ◻
Remark 7. Proposition 6 is not a count of completely unclustered BWT images. It counts all possible BWT images with a fixed Parikh vector. The refined numbers relevant to \(U_k(n)\) are \[B_k^{\mathrm{unc}}(\alpha,r)= \#\{L:\operatorname{Parikh}(L)=\alpha, \;\pi_L\text{ is a single cycle}, \;\rho(L)=n, \;\rho_{\circ}(\operatorname{BWT}^{-1}(L))=r\}.\] Then \[U_k(n)=\min\{r:\exists\alpha\text{ with }B_k^{\mathrm{unc}}(\alpha,r)>0\}.\] Thus the sharpness conjecture is a run-refined and unclustered refinement of the GRR enumeration.
The GRR viewpoint also gives a useful permutation-only model. Fix a Parikh vector \(\alpha\) of total size \(n\), and partition \(\{0,\ldots,n-1\}\) into consecutive blocks \[I_0,I_1,\ldots,I_{k-1}, \qquad |I_a|=\alpha_a.\] Let \[b_\alpha(r)=a\quad\text{if }r\in I_a.\] A permutation \(\tau\in S_n\) is called \(\alpha\)-ascending if it is increasing on each block \(I_a\): whenever \(r<s\) and \(r,s\in I_a\), one has \(\tau(r)<\tau(s)\).
Proposition 8. Fix \(\alpha\) and define \(b_\alpha\) as above. Words \(L\in\Sigma_k^n\) with Parikh vector \(\alpha\) are in bijection with \(\alpha\)-ascending permutations \(\tau\in S_n\), by the rule \[L_i=b_\alpha(\tau^{-1}(i)).\] Under this bijection:
\(L\) is the BWT image of one primitive necklace if and only if \(\tau\) is an \(n\)-cycle;
\(L\) is completely unclustered if and only if \[b_\alpha(\tau^{-1}(i))\ne b_\alpha(\tau^{-1}(i+1)) \qquad(0\le i<n-1);\]
if \(\tau\) is an \(n\)-cycle, then \[\rho_{\circ}(\operatorname{BWT}^{-1}(L))= \#\{r\in\{0,\ldots,n-1\}:b_\alpha(r)\ne b_\alpha(\tau(r))\}.\]
Consequently, \(U_k(n)\) is the minimum of the crossing number in item (c) over all Parikh vectors \(\alpha\) with at most \(k\) parts and all \(\alpha\)-ascending \(n\)-cycles \(\tau\) satisfying the no-adjacent-equal condition in item (b).
Proof. The stable sorting condition is exactly the assertion that \(\tau\) is increasing on each block. The formula \(L_i=b_\alpha(\tau^{-1}(i))\) follows by construction. The one-cycle condition is the standard BWT image criterion, and the crossing formula is Proposition 3 rewritten in block colours. ◻
Proposition 8 is often the cleanest formulation of the exact sharpness problem. Conjecture 10 asks whether, for every sufficiently large \(n\), one can choose \(\alpha\) and an \(\alpha\)-ascending \(n\)-cycle \(\tau\) satisfying the no-adjacent-equal output condition and having exactly \(\lceil n/2\rceil\) colour-crossing cycle edges.
The lower bound of Proposition 1 is sharp in many small cases. The following table lists completely unclustered BWT images \(L\) over the ternary alphabet and one inverse necklace representative \(u\). The examples prove the corresponding upper bounds for every alphabet size \(k\ge3\).
| \(n\) | \(L\) | one inverse \(u\) | \(\rho_{\circ}([u])\) | \(\lceil n/2\rceil\) |
|---|---|---|---|---|
| 4 | 1010 | 0011 | 2 | 2 |
| 5 | 10120 | 00211 | 3 | 3 |
| 6 | 101201 | 001211 | 4 | 3 |
| 7 | 1012021 | 0012211 | 4 | 4 |
| 8 | 10120121 | 00112211 | 4 | 4 |
| 9 | 101012020 | 000221011 | 5 | 5 |
| 10 | 1010121020 | 0002210111 | 5 | 5 |
| 11 | 10201021201 | 00021122011 | 6 | 6 |
| 12 | 101010101010 | 000100111011 | 6 | 6 |
The length \(6\) example shows that \(U_k(6)\le4\), while the general lower bound only gives \(U_k(6)\ge3\). A finite enumeration shows that the value \(3\) is impossible.
Proposition 9. For every \(k\ge3\), \[\begin{gather} U_k(1)=1,\quad U_k(2)=2,\quad U_k(3)=3,\quad U_k(4)=2,\\ U_k(5)=3,\quad U_k(6)=4,\quad U_k(7)=4,\quad U_k(8)=4. \end{gather}\] Moreover, Table 1 gives sharp examples for \(n=9,10,11,12\), so \[U_k(n)=\left\lceil\frac{n}{2}\right\rceil \qquad(9\le n\le12,\, k\ge3).\]
Proof. For \(n=1,2,3\) the assertion is checked directly. In length \(2\), a primitive necklace must use two distinct letters, so its cyclic run number is \(2\). In length \(3\), a completely unclustered binary word has the form \(aba\), but its standard permutation has a fixed point and hence is not a BWT image of an aperiodic necklace. Therefore a completely unclustered BWT image of length \(3\) must use three distinct letters, and the inverse necklace has three cyclic runs.
For \(4\le n\le8\), the lower bound from Proposition 1 gives the sharp value except for \(n=6\). The table gives examples attaining the lower bound for \(n=4,5,7,8\), and an example with \(4\) input runs for \(n=6\). The impossibility of \(\rho_{\circ}=3\) in length \(6\) was verified by exhaustive enumeration of all ordered equality patterns of length \(6\). The verification does not depend on the alphabet size: every word over any ordered alphabet of length \(6\) is order-isomorphic to one of these finitely many patterns. The verification script is included in Appendix 11.
For \(n=9,10,11,12\), the displayed examples attain the universal lower bound. ◻
Conjecture 10. For every \(k\ge3\), \[U_k(n)=\left\lceil\frac{n}{2}\right\rceil\] for all \(n\ge7\). Together with the small values in Proposition 9, this would give the complete list \[U_k(1)=1, \quad U_k(2)=2, \quad U_k(3)=3, \quad U_k(4)=2, \quad U_k(5)=3, \quad U_k(6)=4,\] and \[U_k(n)=\left\lceil\frac{n}{2}\right\rceil\qquad(n\ge7).\]
Equivalently, over any non-binary alphabet the BWT should be able to be simultaneously maximally unclustered and maximally run-amplifying, up to the universal factor-two lower bound.
By Corollary 1, this is equivalent to the ternary Hamming construction problem stated above.
In the binary case, complete unclusteredness forces \(L\) to be alternating, and the standard/FL mapping becomes conjugate, depending on convention, to multiplication by \(2^{-1}\) or by \(2\) modulo an odd integer.
Proposition 11. Let \(p=2m+1\) be a prime with \(m\) even, and assume that \(2\) is a primitive root modulo \(p\). Then, for every \(k\ge3\), \[U_k(p-1)=m=\frac{p-1}{2}\] and \[U_k(p)=m+1=\frac{p+1}{2}.\] More explicitly, these values are realized by the BWT images \[L^-=(10)^m\] of length \(p-1\), and \[L^+=(10)^{m-1}120\] of length \(p\).
Proof. The universal lower bound, Proposition 1, gives \[U_k(p-1)\ge m, \qquad U_k(p)\ge m+1.\] It remains to construct completely unclustered BWT images with single-cycle standard permutation and the indicated Hamming distance to their sorted rearrangements.
First consider \[L^-=(10)^m, \qquad |L^-|=2m=p-1.\] It is completely unclustered and \[\operatorname{sort}(L^-)=0^m1^m.\] For \(0\le r\le m-1\), the standard permutation satisfies \[\pi_{L^-}(2r)=m+r, \qquad \pi_{L^-}(2r+1)=r.\] Let \(\theta:\{0,\ldots,2m-1\}\to\mathbb{F}_p^\times\) be \(\theta(i)=i+1\pmod p\). Since \[m+1\equiv 2^{-1}\pmod p,\] a direct computation gives \[\theta(\pi_{L^-}(i))=(m+1)\theta(i) \qquad (0\le i\le 2m-1).\] Thus \(\pi_{L^-}\) is conjugate to multiplication by \(2^{-1}\) on \(\mathbb{F}_p^\times\). This is a single cycle precisely because \(2\) is a primitive root modulo \(p\). Hence \(L^-\) is the BWT image of one primitive necklace. Since \(m\) is even, comparing \((10)^m\) with \(0^m1^m\) gives exactly \(m\) matches and therefore \[d_{\mathrm H}(L^-,\operatorname{sort}(L^-))=m.\] By Proposition 3, \(\rho_{\circ}(\operatorname{BWT}^{-1}(L^-))=m\). Hence \(U_k(p-1)\le m\), and equality follows.
Now consider the ternary word \[L^+=(10)^{m-1}120, \qquad |L^+|=2m+1=p.\] It is completely unclustered, has Parikh vector \((m,m,1)\), and \[\operatorname{sort}(L^+)=0^m1^m2.\] The standard permutation is given by \[\begin{align} \pi_{L^+}(2r)&=m+r &&(0\le r\le m-1),\\ \pi_{L^+}(2r+1)&=r &&(0\le r\le m-2),\\ \pi_{L^+}(2m-1)&=2m,\\ \pi_{L^+}(2m)&=m-1. \end{align}\] Let \(\theta:\{0,\ldots,2m\}\to\mathbb{F}_p\) be \(\theta(i)=i+1\pmod p\). Put \(a=m+1\equiv2^{-1}\pmod p\). Then the conjugate map \(T=\theta\pi_{L^+}\theta^{-1}\) satisfies \[T(y)=ay \quad\text{for } y\notin\{0,-1\},\] while \[T(-1)=0, \qquad T(0)=m.\] Multiplication by \(a=2^{-1}\) is one cycle on \(\mathbb{F}_p^\times\), since \(2\) is a primitive root. In that cycle the edge \[-1\longmapsto a(-1)=m\] is replaced by the two edges \(-1\longmapsto 0\longmapsto m.\) Therefore \(T\), and hence \(\pi_{L^+}\), is a single cycle on all of \(\mathbb{F}_p\). Thus \(L^+\) is the BWT image of one primitive necklace.
Finally, because \(m\) is even, the comparison of \[L^+=(10)^{m-1}120 \quad\text{with}\quad \operatorname{sort}(L^+)=0^m1^m2\] has exactly \(m\) matches. Hence \[d_{\mathrm H}(L^+,\operatorname{sort}(L^+))=(2m+1)-m=m+1.\] By Proposition 3, the inverse necklace has \(m+1\) cyclic runs. Thus \(U_k(p)\le m+1\), and the lower bound gives equality. The same BWT images use at most three letters, so they are valid over every alphabet \(\Sigma_k\) with \(k\ge3\). ◻
Corollary 2. Assume the following Artin-type hypothesis in arithmetic progressions: there exist infinitely many primes \(p\equiv5\pmod8\) for which \(2\) is a primitive root modulo \(p\). Then Conjecture 10 holds for infinitely many pairs of consecutive lengths \[n=p-1, \qquad n=p.\] Equivalently, it holds for infinitely many pairs of consecutive lengths \[p-1\equiv4\pmod8,\qquad p\equiv5\pmod8.\]
Proof. If \(p\equiv5\pmod8\), then \(p=2m+1\) with \(m=(p-1)/2\) even. Applying Proposition 11 gives \[U_k(p-1)=\frac{p-1}{2}=\left\lceil\frac{p-1}{2}\right\rceil\] and \[U_k(p)=\frac{p+1}{2}=\left\lceil\frac{p}{2}\right\rceil.\] The assumed infinitude of such primes gives infinitely many such pairs. ◻
Remark 12. The hypothesis used in Corollary 2 is a special case of Artin’s primitive root conjecture with prescribed congruence conditions: for admissible data one expects a positive density of primes \(p\equiv a\pmod f\) for which a fixed integer \(g\) is a primitive root modulo \(p\). See Lenstra [8] and Moree [9], [10] for this formulation and related density results. It is not known unconditionally in the special case used above.
The following observation gives a universal Parikh obstruction for sharp examples. It will also be used below to evaluate the GRR multiset relaxation.
Lemma 2. Let \(L\in\Sigma_k^n\) satisfy \(L_i\ne L_{i+1}\) for all \(0\le i<n-1\), let \(F=\operatorname{sort}(L)\), and put \(\tau=\pi_L^{-1}\). Fix a letter \(a\), put \(m_a=|L|_a\), and let \(C_a=\sum_{b<a}|L|_b.\) Thus the \(a\)’s occupy the block \[I_a=\{C_a,C_a+1,\ldots,C_a+m_a-1\}\] in the sorted word \(F\). If \(m_a\) is odd and \[\#\{i\in I_a:L_i=a\}=\frac{m_a+1}{2},\] then \(\tau\) has a fixed point \(j\) with \(L_j=a\). In particular, the GRR cycle decomposition of \(\tau\) contains a letter-constant cycle.
Proof. Write \(m_a=2s+1\). Since \(L\) has no equal adjacent letters, the positions of the letter \(a\) inside the interval \(I_a\) form an independent set in a path of length \(2s+1\). If this independent set has maximum size \(s+1\), it is necessarily \[C_a,\;C_a+2,\;C_a+4,\ldots,\;C_a+2s.\] Let \[P_0<P_1<\cdots<P_{2s}\] be the positions of all occurrences of \(a\) in \(L\). By definition of stable sorting, \[\tau(C_a+t)=P_t\qquad(0\le t\le 2s).\] Let \(\ell\) be the number of occurrences of \(a\) lying strictly before the block \(I_a\). Since there are only \(s\) occurrences of \(a\) outside \(I_a\), one has \(0\le \ell\le s\), and \[P_{\ell+j}=C_a+2j\qquad(0\le j\le s).\] Taking \(j=\ell\) gives \[P_{2\ell}=C_a+2\ell.\] Hence \[\tau(C_a+2\ell)=P_{2\ell}=C_a+2\ell,\] which is a fixed point. Since \(L_{C_a+2\ell}=a\), this fixed point is a letter-constant GRR cycle. ◻
Proposition 13. Let \([u]\) be a primitive necklace of length \(n>1\), put \(L=\operatorname{BWT}([u])\), and suppose that \[\rho(L)=n, \qquad \rho_{\circ}([u])=\left\lceil\frac{n}{2}\right\rceil.\] Let \(\mathbf{m}=\operatorname{Parikh}(u)=\operatorname{Parikh}(L)\). Then:
if \(n\) is even, every nonzero component of \(\mathbf{m}\) is even;
if \(n\) is odd, exactly one component of \(\mathbf{m}\) is odd.
Proof. Let \(F=\operatorname{sort}(L)\), and for every letter \(a\) let \(I_a\) be the block of the \(a\)’s in \(F\). Put \[s_a=\#\{i\in I_a:L_i=a\}.\] By Proposition 3, \[d_{\mathrm H}(L,F)=\rho_{\circ}([u])=\left\lceil\frac{n}{2}\right\rceil.\] Equivalently, the number of matches between \(L\) and \(F\) is \[\sum_a s_a=n-d_{\mathrm H}(L,F)=\left\lfloor\frac{n}{2}\right\rfloor.\]
Since \(L\) has no equal adjacent letters, in each block \(I_a\) the matching positions form an independent set. Thus \(s_a\le \lceil m_a/2\rceil\). If \(m_a\) is odd and equality held, Lemma 2 would produce a letter-constant GRR cycle. But in the present one-necklace case the standard permutation is a single nonconstant cycle; hence no letter-constant cycle can occur. Therefore, in fact \[s_a\le \left\lfloor\frac{m_a}{2}\right\rfloor \qquad\text{for every }a.\] Consequently, if \(x\) denotes the number of odd components of \(\mathbf{m}\), then \[\left\lfloor\frac{n}{2}\right\rfloor =\sum_a s_a \le \sum_a \left\lfloor\frac{m_a}{2}\right\rfloor =\frac{n-x}{2}.\] If \(n\) is even, then \(x\) is even, and the inequality forces \(x=0\). If \(n\) is odd, then \(x\) is odd, and the inequality forces \(x=1\). This proves the claim. ◻
Remark 14. In the binary case, a sharp completely unclustered example of length \(n>1\) can exist only when \[n=4q, \qquad \operatorname{Parikh}(u)=(2q,2q).\] For this binary Parikh vector, the only possible BWT images are the two alternating words. The standard binary calculation identifies the corresponding FL-mapping with multiplication by \(2\) modulo \(n+1\). By the known binary classification of completely unclustered BWT images via the alternating word and the primitive-root condition [2], [3], \[n+1\text{ is prime}, \qquad 2\text{ is a primitive root modulo }n+1, \qquad n+1\equiv5\pmod8.\]
Remark 15. Proposition 13 is a necessary condition, not a full classification for alphabets of size at least three. The remaining obstruction is genuinely a standard-cycle obstruction: even when the parity condition holds, one must still construct an unclustered word \(L\) with the prescribed content, with \(\pi_L\) a single cycle, and with \(d_{\mathrm H}(L,\operatorname{sort}(L))=\lceil n/2\rceil\). Thus the parity obstruction is the universal Parikh part of Problem 17, while the residual part is the sharp BWT-image construction problem with fixed content.
The unrestricted one-cycle baseline for a fixed Parikh vector is already given by Proposition 6. The sharp Parikh-constrained problem is therefore a refinement of the GRR enumeration by two extra conditions: the no-adjacent-equal condition on \(L\), and the Hamming condition \(d_{\mathrm H}(L,\operatorname{sort}(L))=\lceil n/2\rceil\). Proposition 8 reduces this refinement to a finite problem about \(\alpha\)-ascending coloured cycles with a prescribed number of colour-crossing edges.
Theorem 16. For every \(k\ge3\), \[\widetilde{U}_k(n)= \begin{cases} 1,& n=1,\\ 2,& n=2,\\ 3,& n=3,\\ 2,& n=4,\\ 3,& n=5,\\ 4,& n=6,\\ \left\lceil n/2\right\rceil,& n\ge7. \end{cases}\]
Proof. We first prove the lower bound. Let \(L\in\Sigma_k^n\) satisfy \(\rho(L)=n\), let \(F=\operatorname{sort}(L)\), and put \(\tau=\pi_L^{-1}\). As in the proof of Proposition 13, let \[s_a=\#\{i\in I_a:L_i=a\},\] where \(I_a\) is the block of the \(a\)’s in \(F\). Let \(x\) be the number of odd components of \(\operatorname{Parikh}(L)\), and let \(E\) be the number of odd letters \(a\) for which \(s_a=(m_a+1)/2\). Then \[\sum_a s_a\le \sum_a\left\lfloor\frac{m_a}{2}\right\rfloor+E =\frac{n-x}{2}+E.\] By Lemma 2, each of the \(E\) exceptional odd blocks contributes a distinct letter-constant GRR cycle. Therefore \(c_0(L)\ge E\). Using Proposition 4, we get \[\begin{align} R_{\operatorname{GRR}}(L) &=d_{\mathrm H}(L,F)+c_0(L)\\ &=n-\sum_a s_a+c_0(L)\\ &\ge n-\left(\frac{n-x}{2}+E\right)+E =\frac{n+x}{2} \ge \left\lceil\frac{n}{2}\right\rceil . \end{align}\] This proves the universal lower bound \(\widetilde{U}_k(n)\ge\lceil n/2\rceil\). The small lengths \(n=2,3,6\) require the stronger values displayed in the statement. The cases \(n=2,3\) are immediate. For \(n=6\), equality in the lower bound would force all Parikh components to be even. Since \(L\) is unclustered, the only possible content is \((2,2,2)\). Indeed, all nonzero multiplicities must be even, and in an unclustered linear word of length \(6\) no letter can occur more than \(3\) times. A direct check of the finite possibilities with one match in each of the three sorted blocks, implemented in Appendix 11, shows that at least one letter-constant GRR cycle is unavoidable; hence \(R_{\operatorname{GRR}}(L)\ge4\).
It remains to give matching constructions. The small cases are realized by \[0, \quad 01, \quad 010, \quad 1010, \quad 01010, \quad 010101\] for \(n=1,2,3,4,5,6\), respectively. For \(n\ge7\), write \(n\) in one of the following forms and choose \(L_n\) as follows: \[L_n= \begin{cases} (10)^{2q}, & n=4q,\;q\ge1,\\ (01)^{2q}0, & n=4q+1,\;q\ge1,\\ (10)^q12(10)^{q-1}20, & n=4q+2,\;q\ge2,\\ 1012021(2121)^{q-1}, & n=4q+3,\;q\ge1. \end{cases}\] Each word in this list is completely unclustered. For the four families displayed above, the stable permutations are elementary to compute. Their Hamming distances and constant-cycle corrections are: \[\begin{array}{c|c|c} n & d_{\mathrm H}(L_n,\operatorname{sort}(L_n)) & c_0(L_n)\\ \hline 4q & 2q & 0\\ 4q+1 & 2q & 1\\ 4q+2 & 2q+1 & 0\\ 4q+3 & 2q+2 & 0. \end{array}\] Therefore, by Proposition 4, \[R_{\operatorname{GRR}}(L_n)=\left\lceil\frac{n}{2}\right\rceil\] in every length \(n\ge7\). This proves the matching upper bound and completes the proof. ◻
Thus the GRR relaxation is completely determined; the remaining gap is exactly the one-cycle sharpness defect.
Corollary 3. For every \(k\ge3\), the GRR gap satisfies \[U_k(n)-\widetilde{U}_k(n)=0 \qquad(1\le n\le6),\] and, for every \(n\ge7\), \[U_k(n)-\widetilde{U}_k(n) = U_k(n)-\left\lceil\frac{n}{2}\right\rceil.\] Consequently, in length \(n\ge7\), there exists a minimizer \(L\) for \(\widetilde{U}_k(n)\) whose standard permutation is a single \(n\)-cycle if and only if the sharp bound \[U_k(n)=\left\lceil\frac{n}{2}\right\rceil\] holds in that length.
Proof. The displayed formulae follow immediately from Theorem 16 and the known small values in Proposition 9. The final assertion is just the one-cycle interpretation of \(U_k(n)\): equality of the two minima means precisely that some minimum GRR word can be chosen to be a one-cycle BWT image. ◻
The correction formula 6 shows why this question is subtler than a pure crossing-number relaxation: splitting a permutation into several GRR cycles may reduce the number of crossing edges, but letter-constant cycles contribute one run each. Thus a putative strict inequality \(\widetilde{U}_k(n)<U_k(n)\) must overcome this constant-cycle correction.
Problem 17. Let \(\mathbf{m}=(m_0,\ldots,m_{k-1})\) and let \(n=|\mathbf{m}|=\sum_a m_a\). For which \(\mathbf{m}\) does there exist a primitive necklace \([u]\) over \(\Sigma_k\) with \[\operatorname{Parikh}(u)=\mathbf{m},\qquad \rho(\operatorname{BWT}([u]))=n,\qquad \rho_{\circ}([u])=\left\lceil\frac{n}{2}\right\rceil?\]
Problem 18. Construct, in linear or near-linear time, words \(L_n\in\Sigma_3^n\) satisfying the three conditions of Corollary 1.
Problem 19. For a fixed \(k\ge3\), for which \(n\) does there exist a minimizer \(L\) for \(\widetilde{U}_k(n)\) such that \(\pi_L\) is an \(n\)-cycle?
By Corollary 3, for \(n\ge7\) this is equivalent to Conjecture 10.
The following Python script exhaustively enumerates all ordered equality patterns of length \(6\). This verifies both \(U_k(6)=4\) and \(\widetilde{U}_k(6)=4\). Since every word of length \(6\) over an ordered alphabet is order-isomorphic to one of these patterns, the verification is independent of the alphabet size. Here two words are order-isomorphic if they induce the same equality pattern and the same relative order on the occurring letters.
from itertools import product
def stable_permutation(L):
F = sorted(L)
occ_F, pos = {}, {}
for j, c in enumerate(F):
r = occ_F.get(c, 0)
pos[(c, r)] = j
occ_F[c] = r + 1
occ_L, pi = {}, []
for c in L:
r = occ_L.get(c, 0)
pi.append(pos[(c, r)])
occ_L[c] = r + 1
return pi
def inverse_perm(p):
q = [0] * len(p)
for i, j in enumerate(p):
q[j] = i
return q
def cycles(p):
seen = [False] * len(p)
out = []
for i in range(len(p)):
if not seen[i]:
C, x = [], i
while not seen[x]:
seen[x] = True
C.append(x)
x = p[x]
out.append(C)
return out
def is_one_cycle(p):
return len(cycles(p)) == 1
def is_unclustered(L):
return all(L[i] != L[i+1] for i in range(len(L)-1))
def hamming_to_sorted(L):
F = sorted(L)
return sum(L[i] != F[i] for i in range(len(L)))
def constant_cycle_correction(L):
tau = inverse_perm(stable_permutation(L))
return sum(len({L[i] for i in C}) == 1 for C in cycles(tau))
def grr_run_number(L):
return hamming_to_sorted(L) + constant_cycle_correction(L)
def canonical_pattern(L):
alphabet = sorted(set(L))
relabel = {c: i for i, c in enumerate(alphabet)}
return tuple(relabel[c] for c in L)
n = 6
patterns = sorted({
canonical_pattern(L)
for L in product(range(n), repeat=n)
})
best_one_cycle = None
best_grr = None
count_best_one_cycle = 0
count_best_grr = 0
for L in patterns:
if not is_unclustered(L):
continue
pi = stable_permutation(L)
h = hamming_to_sorted(L)
if is_one_cycle(pi):
if best_one_cycle is None or h < best_one_cycle:
best_one_cycle = h
count_best_one_cycle = 1
elif h == best_one_cycle:
count_best_one_cycle += 1
grr = grr_run_number(L)
if best_grr is None or grr < best_grr:
best_grr = grr
count_best_grr = 1
elif grr == best_grr:
count_best_grr += 1
print("number of ordered equality patterns:", len(patterns))
print("best one-cycle:", best_one_cycle)
print("number of best one-cycle patterns:", count_best_one_cycle)
print("best GRR:", best_grr)
print("number of best GRR patterns:", count_best_grr)
assert best_one_cycle == 4
assert best_grr == 4
The output is:
number of ordered equality patterns: 4683
best one-cycle: 4
number of best one-cycle patterns: 19
best GRR: 4
number of best GRR patterns: 67
Thus the enumeration verifies both \(U_k(6)=4\) and \(\widetilde{U}_k(6)=4\).