Generating key points…
Answers are grounded in this paper and cite their sources.
A binary bracelet is an equivalence class of length-\(n\) words under rotation and reversal. Represent each class by its lexicographically least word, with \(0<1\), and fix the density \(D\), the number of ones. For every \(n≥1\), \(0≤ D≤ n\) and binary threshold \(t\) of length \(n\), the inclusive rank counts the representatives of density \(D\) at most \(t\). This rank can be computed in \(O(n^5)\) arithmetic operations on \(O(n)\)-bit integers, answering the question posed by Adamson, Deligkas, Gusev and Potapov in the arithmetic model used for the comparison with fixed-density necklaces. The bit-time bound with ordinary exact integer arithmetic is \(O(n^6)\). CPM 2021 talk, final slide 17/17, PDF p. 24 The count works by subtracting the words whose circular readings in both directions all exceed the threshold. First replace \(t\) by the greatest necklace representative \(x=x_0⋯ xₙ₋₁\) at most \(t\), using the existing \(O(n^2)\) necklace routine. A necklace representative is the least rotation of a word, and every bracelet representative is also a necklace representative, so this replacement preserves the rank. Write \(U(x)\) for the words for which every length-\(n\) circular reading in either direction is strictly greater than \(x\). Sawada and Williams, §2 and Algorithm 1, PDF p. 4 Both reading directions can be checked while scanning the letters in their original order. For the forward direction, keep the length \(i∈\{0,…,n-1\}\) of the longest suffix of the letters read that matches a proper prefix of \(x\). On reading bit \(a\), set \[F(i,a)={cases} i+1,&a=x_i and i+1<n,\\ 0,&a>x_i,\\ reject,&otherwise. {cases} \] For the backward direction, append a symbol \(>1\) to each suffix of \(x\). Set \(s_j=x_j⋯ xₙ₋₁\) for \(0≤ j<n\), and \(s_n=\). Let \(o_j\) be the position of \(s_j\) in the increasing list of these \(n+1\) words, numbered from zero. If \(Y\) is the history read backwards from the current position, store only \(q=#\{j:s_j<Y\}\). A new bit \(a\) prepends to \(Y\), so the update is \[q'=∑ⱼ₌₀ⁿ⁻¹ 1\{x_j<a or (x_j=a and oⱼ₊₁<q)\}, \] where \( 1\) is the indicator of the condition in braces. Reject if \(q'≤ o_0\). The final symbol \(\) ensures that a reversed window equal to \(x\) is rejected too. Pair the two states into a graph \(G\) and retain the bit-labelled edges accepted by both updates. Both states are determined by the most recent \(n\) letters after \(n\) accepted steps. A block of length \(g≥1\) therefore labels exactly one closed walk with a specified starting position if repeating the block passes both tests, and zero otherwise. This also counts blocks that repeat a shorter block. Let \(C(g,w)\) count these closed walks of length \(g\) with \(w\) one-edges. To compute it, use the states \( R=\{(0,q)∈ G\}\). Every nonempty closed walk visits \( R\), since the forward prefix length increases on every edge that avoids it. Let \(J,c(u,v)\) count paths from \(u\) to \(v\) in \( R\) of length \(\) with \(c\) one-edges and no interior visit to \( R\). Let \(PL,d(v,u)\) count paths of length \(L\) and weight \(d\) from \(v\) to \(u\), allowing all intermediate states. Then \[C(g,w)=∑u,v∈ R∑₌₁ᵍ∑c=0^{} \,J,c(u,v)Pg-,w-c(v,u). \] The factor \(\) counts the possible positions of the specified start within the segment between consecutive visits. For a given \(u\) and \(\), the sole possible binary label for that segment is the prefix of \(x\) of length \(-1\) followed by a one, and it is eligible only if \(x₋₁=0\). Follow the transitions to check eligibility, find \(v\) and count \(c\). For each terminal state \(u\), initialise \(P0,0(u,u)=1\), with all other length-zero entries zero, and compute \[PL,d(v,u)=∑_{v{a}z}PL-1,d-a(z,u)(L≥1), \] where the sum runs over the accepted outgoing edges and entries with \(d<0\) or \(d>L\) are zero. This computation on the sparse graph gives all the rotation counts needed for one rank query within the quintic arithmetic bound. For a rotation of order \(h\), a fixed word consists of \(h\) copies of a block of length \(n/h\), so it can have density \(D\) only if \(h D\). For a reflection, write \(b^R\) for the reversal of \(b\). With the starting position aligned to the reflection, its fixed words and the number of reflections of each type are \[{array}{c|c|c|c} n & fixed word & f fixed vertices & μ_f reflections\\ 2m+1 & a b b^R,\ |b|=m & 1 & n\\ 2m & b b^R,\ |b|=m & 0 & n/2\\ 2m & a b c b^R,\ |b|=m-1 & 2 & n/2 {array} \] Here \(a,c\) are single bits. A reflection-fixed word already has its reversal among its rotations, so its strict upper count \(B_f(n,D;x)\) uses just the forward transitions. Initialise a pair of endpoints \((i,i)\) for each forward state \(i\). If the form starts with a fixed letter \(a\), advance the left endpoint along its \(a\)-edge and add \(a\) to the weight. At each paired position choose a bit \(e\), advance the left endpoint along its \(e\)-edge and move the right endpoint backwards along each incoming \(e\)-edge, adding \(2e\). Discard rejected moves. At the centre require equal endpoints if there is no fixed centre bit. Otherwise require a forward edge from the left endpoint to the right and add its bit. Sum the counts of weight \(D\). This computation takes \(O(n^4)\) arithmetic operations. With \(φ(h)\) denoting Euler's totient, the number of rotations of order \(h\), Burnside's lemma gives the inclusive rank \[1/2n[∑_{{h n\\ h D}}φ(h) ({n/h}{D/h}-C(n/h,D/h)) +∑_fμ_f(∑ⱼ₌₀^f fj{(n-f)/2}{(D-j)/2}-B_f(n,D;x) )]. \] The sum over \(f\) uses the rows for the parity of \(n\). A binomial coefficient with a noninteger lower index or one outside the range from zero to its upper index contributes zero. The formula includes \(D=0,n\) and the formal dihedral actions at \(n=1,2\). To recover the representative of one-based rank \(r\), first use the rank at \(1^n\) to check that \(r\) lies between one and the total count. For each successive digit, query the rank at the prefix extended by zero and filled out with ones. Keep the zero if the count reaches \(r\), and choose one otherwise. This takes one rank query per digit after the initial count. The paper's fixed-content question also has a polynomial-time answer for each fixed ordered alphabet size \(k\). For prescribed nonnegative counts \(p_1,…,p_k\) summing to \(n\), track the first \(k-1\) symbol counts, with the last determined by the length. The suffix comparison is unchanged with \(\) above all symbols, and each first return can use any strictly greater final letter that gives an accepted edge. A rotation of order \(h\) requires every \(p_a\) to be divisible by \(h\) and uses block content \((p_a/h)ₐ₌₁^k\). For a reflection, enumerate the symbols on its at most two fixed vertices, subtract their counts and halve each residual count for the paired positions. Assignments with negative or odd residual counts contribute zero. The unrestricted fixed counts use multinomial coefficients for the resulting block or half-word content. The arithmetic bound is \(O(k n^4∏ₐ₌₁ᵏ⁻¹(p_a+1))\). For \(k≥2\), binary search over the next symbol gives unranking with \(O(nlog k)\) rank queries, including the initial count. For \(k=1\), there is one representative. A quintic bit bound for the binary case and a joint polynomial bound with unrestricted alphabet size remain separate questions. Ranking Bracelets in Polynomial Time, §6, PDF p. 22
No takes yet. Share an insight, caveat, or question.
Zixuan He (2026) studied this question.
Synapse has enriched 8 closely related papers on similar clinical questions. Consider them for comparative context: