Generating key points…
Answers are grounded in this paper and cite their sources.
A necklace with an unlabelled alphabet identifies words that differ by a cyclic rotation or by a single permutation of the alphabet applied throughout the word. For a length \(n≥ 1\) and an alphabet \([k]=\{0,…,k-1\}\), order these classes by their lexicographically least words. The least relabelling of any one rotation numbers its distinct symbols \(0,1,…\) in order of first occurrence. Taking the least of these normalised rotations gives the representative. The same ordering supports both generation, which lists representatives in sequence, and ranking, which counts how many representatives lie at or below a given word. Joe Sawada asked for constant-amortised-time generation for each fixed \(k≥ 2\), highlighting \(k=3\) and \(k=4\). The algorithm lists every representative exactly once in increasing lexicographic order, for every such \(k\) and every \(n≥ 1\). It uses \(O_k(1)\) amortised word-RAM operations per representative and \(O_k(n)\) working words. Each emission gives a callback access to the current buffer. Copying or printing its \(n\) symbols costs an additional \(O(n)\) per representative. The constants may depend on \(k\), and the algorithm stores records for all \(k!\) permutations. The booklet's separate suggestion of \(O(n)\) amortised generation when \(k\) can vary remains open here. CAG 2024 open problems booklet, Problem 18, p. 32 The generator uses the ordinary prenecklace recursion of Cattell, Ruskey, Sawada, Serra and Miers. A prenecklace is a prefix of an ordinary necklace representative, where only rotations are identified. With positions numbered from zero, start with \(w_0=0\) and \(p=1\). At a prefix \(w\) of length \(t\), the integer \(p\) is the length of its longest Lyndon prefix, a word strictly smaller than each of its nontrivial rotations. Try the next symbol in increasing order over \(wₜ₋ₚ≤ a≤min(k-1,1+max(w))\). Keep \(p\) if \(a=wₜ₋ₚ\), and set it to \(t+1\) otherwise. For each permutation \(π\) and shift \(1≤ j<t\), compare the relabelled suffix \(π(w_j⋯ wₜ₋₁)\) with the prefix \(w_0⋯ wₜ₋ⱼ₋₁\). A smaller suffix discards the branch. A larger suffix leaves a stored first mismatch, so only ties need further comparisons as the word grows. At depth \(n\), require \(p n\). For a remaining tie at \((π,j)\), put \(d=n-j\) and look up the mismatch at \((π⁻¹,d)\). A tie there certifies equality around the wrap. Otherwise its offset \(a\) gives the wrapped comparison of \(π(w_a)\) with \(wd+a\). Discard the word if the former is smaller and emit it if all tests pass. This lookup resolves each wrap in constant time. For a fixed permutation and shift, a tied suffix is determined by the first \(j\) symbols through \(wⱼ₊ₐ=π⁻¹(w_a)\) for \(0≤ a<t-j\). That restriction controls the total work in the tied records, including on branches that produce no output. Duncan Adamson asked whether these classes can be ranked in polynomial time over an arbitrary finite alphabet, and separately asked for a faster binary algorithm. For each fixed \(k≥ 1\), the inclusive rank takes \(O_k(n^3)\) arithmetic operations and \(O_k(n^4)\) bit operations. For \(k=2\), the \(O(n^4)\) bit bound improves the earlier \(O(n^6log^2 n)\) time bound. A second algorithm gives a uniform polynomial bound for each fixed number of distinct symbols in the threshold, even when the alphabet size is given as part of the input. The unrestricted joint polynomial-time question remains open here. Adamson's DCFS 2022 slides, final slide 19/19, first and second Future Work bullets For any threshold \(x=x_1⋯ x_n∈[k]^n\), even one that is not a least representative, write \(Rn,k(x)\) for the number of least representatives at most \(x\). To compute it, first recognise the complementary set of words whose every relabelled rotation is strictly greater than \(x\). Their periodic extensions avoid the factors \[ B=\{π(x_1⋯ xⱼ₋₁a) π∈ S_k,\ 1≤ j≤ n,\ a∈[k],\ a<x_j\}\ ∪\ \{π(x)π∈ S_k\}, \] where \(S_k\) is the group of permutations of \([k]\). The full-threshold factors detect equality, which makes the resulting rank inclusive. Use as automaton states the relabelled proper prefixes of \(x\) that contain no factor from \( B\), including the empty word. On appending a symbol, reject if a forbidden suffix is completed. Otherwise keep the longest suffix that is a relabelled proper prefix. For \(T⊆[k]\), let \(L_T^d(q,q')\) count the nonrejecting paths of length \(d\) from state \(q\) to state \(q'\) with letters in \(T\), counting different letter choices separately. These counts can be computed by propagating path counts one letter at a time from each initial state. For each \(π∈ S_k\) and positive divisor \(h\) of \(n\), let \(Tπ,h=\{a∈[k]π^h(a)=a\}\), and write \(φ(h)\) for Euler's totient, with \(φ(1)=1\). The exact rank is \[Rn,k(x)=1/nk!∑π∈ S_k∑h nφ(h) [|Tπ,h|n/h-∑_{q with letters in Tπ,h}L_{Tπ,h}n/h(q,π(q))]. \] Here \(π(q)\) acts letter by letter. A rotation of order \(h\) leaves \(d=n/h\) freely chosen positions in a word fixed by that rotation combined with a relabelling. These positions use only symbols fixed by \(π^h\). In the path count, the endpoint records how the relabelling changes the state at the next block boundary. For all rotations of order \(h\), the required boundary relabelling is conjugate to \(π\) on \(Tπ,h\), so the same count applies. The bracket therefore subtracts the fixed words in the strict upper set from all fixed words, and the average counts the desired orbits. Evaluating the formula at a class's least representative gives its one-based position in the generator's order. For a large alphabet, first reduce its size to \(K=min(k,n)\), since a least representative uses only labels below \(K\). If the threshold has an entry outside \([K]\), replace the first such entry and every later entry by \(K-1\). This preserves every comparison with a least representative and adds at most one distinct symbol. Let \(r\) be the number of distinct symbols in the resulting threshold. The uniform algorithm uses \(rO(r)poly(n+log(k+1))\) bit operations. It evaluates the rank by counting permutations with prescribed cycle lengths and prescribed images of the symbols appearing in a prefix. In detail, for each \(h n\) let \(d=n/h\) and let \( H\) be the set of positive divisors of \(h\). Group the permutations of \([K]\) by \(f=|Tπ,h|\). For a set \( D\) of allowed cycle lengths, the number \(PD(a)\) of permutations on \(a\) labels with those lengths satisfies \[PD(0)=1, PD(a)=∑∈ D,\,≤ a(a-1)₋₁PD(a-)(a≥1), \] where \((z)_b\) counts ordered selections of \(b\) distinct labels from \(z\), with \((z)_0=1\). For a fixed set of \(f\) labels the unrestricted fixed count, summed over the permutations on those labels, is \(PH(f)f^d\). To get the strict upper count, use one first-occurrence-normalised state \(q_i\) for each safe proper prefix length \(i\), including zero. If \(q_i\) uses \(s_i≤ f\) labels, identify these with the first \(s_i\) labels of the \(f\)-set. Enumerate injective image tuples \(θ\) for these labels, keeping images among the initial labels exact and naming the other images in first-occurrence order. For each tuple using \(b≤ f-s_i\) other labels, add \[(f)s_i(f-s_i)_b\,EH(f,θ)\,L_T^d(q_i,θ(q_i)), \] where \(T\) is the fixed \(f\)-set and \(EH(f,θ)\) counts permutations on it extending the tuple and having cycle lengths in \( H\). Subtract the sum of these terms from \(PH(f)f^d\), weight the difference by \( Kf PH^c(K-f)φ(h)\), sum over \(0≤ f≤ K\) and \(h n\), and divide by \(nK!\). The complement \( H^c\) is taken among positive integers. To compute \(EH\), return zero if any forced cycle has a forbidden length. Remove the permitted forced cycles and contract each forced directed path to an item weighted by its number of vertices. Unused labels have weight one. Count cycles of these items with total weight in \( H\). For a cycle containing a specified path item, choosing a subset of \(m\) other path items and \(a\) of the \(u\) unused labels gives \( ua(m+a)!\) cyclic orders for that subset and number of labels. Repeat on the remaining items, using \(PH\) when only unused labels remain. To compute the path count, preserve the identity of every symbol in the two endpoints and normalise the other labels in each running state by first occurrence. Try each distinguished or currently present label individually. All remaining labels can be tried together with their multiplicity. The suffix test uses partial bijections to threshold prefixes: a possible final symbol is either its known preimage or, for an unassigned image, any unused label of \([K]\). This lets the automaton test for a decrease and for full-threshold equality without listing the forbidden factors. Retaining endpoint identities permits exact counting while keeping the combinatorial dependence on threshold support rather than alphabet size.
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: