Generating key points…
Answers are grounded in this paper and cite their sources.
A single order-\(n\) de Bruijn cycle can be turned into a perfect necklace for any residue modulus \(t\). An \((a,n,t)\)-perfect necklace is a cyclic word of length \(ta^n\) over \(\{0,…,a-1\}\) in which every length-\(n\) word occurs exactly once at a starting position in each residue class modulo \(t\). Fillmore and colleagues asked for new constructions and efficient generation. The construction below works for every integer \(a≥2\) and \(n,t≥1\) and accepts any order-\(n\) de Bruijn cycle as its starting point. A canonical choice of cycle also gives efficient streaming and indexing. Fillmore et al., §9, Question 9.3 An order-\(n\) de Bruijn cycle contains each length-\(n\) word once among its cyclic windows. Set \(A=a^n\) and \(B=A-1\). Rotate the cycle so that its first emitted symbol is the last zero of its unique \(0^n\) window. Write the resulting word as \(0v\), so \(v\) has length \(B\). With \(h=(B,t)\) and \(q=t/h\), the perfect necklace is \[W=(v^q0)^h\,0ᵗ⁻ʰ, \] where powers denote repeated concatenation and exponent zero gives the empty word. For example, \(a=2\), \(n=3\) and \(t=14\) give \(v=1011100\) from the cycle \(00010111\). Here \(h=7\) and \(q=2\), so \(W=((1011100)^2 0)^7 0^7\) has length 112 and contains each binary triple once at each starting residue modulo 14. The construction uses the overlap graph whose vertices are words of length \(n-1\) and whose arcs are words of length \(n\), directed from their prefix to their suffix of length \(n-1\). Each arc emits its final symbol. The marked \(0^n\) arc is a self-loop, so deleting it leaves a closed walk that emits \(v\). Repeating this walk advances the phase by \(B\) on each copy and visits exactly one of the \(h\) residue classes modulo \(h\) in \(q\) copies. The zero between groups advances the phase by one, moving the next group into the next class. The inserted zeros themselves traverse the marked loop once at every phase. Each window's starting phase is its ending phase minus \(n-1\) modulo \(t\). The same construction applies to a finite Eulerian directed graph with a distinguished self-loop. Starting with an Euler tour rooted at that loop, replace \(v\) by the remaining sequence of arcs and each inserted zero by the loop. The result traverses every original arc once at each phase, with the phase advancing by one modulo \(t\) on each step. General existence was already proved using astute graphs, and Fillmore and colleagues' Proposition 5.5 already splices the phase copies of the zero loop into a tour of that graph. The new formula gives the phase groups and their connections explicitly from an ordinary de Bruijn cycle. Álvarez et al., §§2–3, Fillmore et al., Definition 2.2, §4 and Proposition 5.5 For streaming, take \(w\) to be the lexicographically least de Bruijn representative in the standard FKM orientation, which starts with \(n\) zeros. For each copy of \(v\), restart the FKM necklace-prefix generator for \(w\), skip its first \(n\) symbols, emit the rest and append \(n-1\) zeros. With machine words large enough to hold indices up to \(ta^n\), the full stream takes \(O(ta^n)\) time after arithmetic setup and uses \(O(n)\) working words. This is constant amortised time per emitted symbol. Fredricksen and Maiorana, the FKM construction For random access, use the same \(w\), number positions from zero, and take all remainders to be least non-negative. Let \(L=qB+1\) be the length of one group and let \(u=r L\) for a requested index \(0≤ r<tA\). Then \[W[r]={cases} 0 & if r≥ hL or u=L-1,\\ w[(n+(u B)) A] & otherwise. {cases} \] To locate a length-\(n\) word \(x\) in starting residue \(0≤ρ<t\), first compute the ending residue \(p=(ρ+n-1) t\). For \(x=0^n\), its ending index \(e\) is \(pL+qB\) if \(p<h\), and \(hL+p-h\) otherwise. For every other \(x\), query its unique starting index \(λ∈\{1,…,A-1\}\) in \(w\) and put \(j=λ-1\). Compute the group \(i\) and the copy \(s\) within that group by \[i=(p-j) h, s=((B/h)⁻¹p-j-i/h) q, e=iL+sB+j. \] The quotient is integral. For \(q>1\), the inverse is taken modulo \(q\) and exists because \((B/h,q)=1\). For \(q=1\), set \(s=0\). In either case the required starting index in \(W\) is \((e-n+1)(tA)\). Each operation uses at most one query to the base cycle. The available algorithms for \(w\) take \(O(n^3log^2 a)\) word-RAM time for a symbol query and \(O(n^2log a)\) for locating a word. The added modular arithmetic uses integers of \(O(nlog a+log t)\) bits. Thus both operations have bit complexity polynomial in \(n,log a,log t\) without generating \(W\). The bound uses the numerical value of \(n\), including when a random-access request encodes \(n\) in binary.
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: