Generating key points…
Answers are grounded in this paper and cite their sources.
Sawada asked which single forbidden substrings cause his Figure 7.5 necklace generator to fail to run in constant amortised time. For every fixed ordered alphabet \(\{0,…,k-1\}\), \(k≥2\), and every fixed forbidden word \(f\) of length \(m≥3\), the generator fails exactly when \(k=2\) and \(f=10ᵐ⁻¹\), where \(0ᵐ⁻¹\) denotes \(m-1\) consecutive zeros. In this family the average generation work per emitted representative is \(Θ(n)\) as the output length \(n\) grows. In every other case it is bounded independently of \(n\), with the bound allowed to depend on \(k\) and \(f\). This classifies the printed algorithm and extends Sawada's example \(100\) to the full exceptional family. Sawada's dissertation, §7.3.3, closing paragraph on printed p. 72 (PDF p. 84) A necklace is a rotation class of words, represented by its lexicographically least member. A word avoids \(f\) linearly if it has no contiguous copy of \(f\). It avoids \(f\) circularly if no copy starts at any position when the word is read periodically across the join. Figure 7.5 enforces linear avoidance during the search and checks circular avoidance at candidate output. The distinction matters because a candidate that fails the circular check has already incurred generation work. For the exceptional pattern \(f=10^b\), with \(b=m-1≥2\), let \(A(t)\) be the number of binary words of length \(t\) with no linear occurrence of \(0^b\), including \(A(0)=1\). Let \(I(t)\) count words of length \(t\) that avoid \(f\) linearly. For \(n≥1\), \[I(n)=1+∑ⱼ₌₀ⁿ⁻¹A(j), W(n)=Θ(A(n)), N(n)=Θ\!(A(n)/n), \] where \(W(n)\) is the generator's total work and \(N(n)\) is the number of emitted necklaces. The linear count permits any initial run of zeros. On a circle, every zero run in a word containing a 1 follows a 1, so all such runs must have length below \(b\). The constant zero word is also allowed. The factor \(n\) in the output count comes from rotation classes with \(n\) distinct members. Classes with shorter periods contribute at most \(1+∑1≤ j≤ n/2A(j)\), which is \(o(A(n)/n)\) since \(A(j+2)≥2A(j)\). For each \(n≥ b+2\), the rejected candidates include every word \[0^b1v1, |v|=n-b-2, v has no linear occurrence of 0^b. \] Each is strictly smaller than all its nontrivial rotations because its opening zero run is uniquely longest, yet its final 1 and opening zeros form \(f\) across the join. There are \(A(n-b-2)≥2⁻⁽ᵇ⁺²⁾A(n)\) such candidates. This supplies a work lower bound of the same order as the work for the entire search and gives the linear work per output. The bounded cases can be understood through Lyndon words, words that are strictly smaller than all their nontrivial rotations. Write \(L_(t)\) and \(L_c(t)\) for the numbers of linearly and circularly avoiding Lyndon words of length \(t\), respectively. At depth \(t\), each visited prefix is determined by repeating its linearly avoiding Lyndon prefix and truncating at \(t\). This gives at most \(∑ⱼ₌₁^t L_(j)\) visits at that depth. Sawada's growth and circular-count bounds give \(I(t)≥32 I(t-1)\) and \(I(t)/3≤ C(t)≤ I(t)\) for \(t≥ m\), where \(C(t)\) counts circularly avoiding words before taking rotation classes. Consequently \(L_(t)=O(I(t)/t)\) suffices for constant amortised time. Each node costs a bounded amount at fixed \(k,f\), the sum across depths is \(O(I(n)/n)\), and there are at least \(I(n)/(3n)\) outputs for \(n≥ m\). Outside the binary patterns \(aᵐ⁻¹b\) and \(abᵐ⁻¹\) with distinct letters \(a,b\), the forbidden-word automaton is strongly connected. Its state records the length of the longest current suffix that is a proper prefix of \(f\), and transitions that complete \(f\) are omitted. When \(f≠0^m\), there is a legal block of a common finite length \(D\) containing \(0^m\) from each state. The number of legal length-\(t\) words avoiding \(0^m\) is then \(O(I(t)(1-ε)t/D)\) for some \(ε>0\) depending only on \(k,f\). To obtain such constants, choose one block from each state, using paths to the empty state followed by zeros and padding with zeros to length \(D\). If \(u_s\) is the terminal state of the chosen block from \(s\), one may take \(ε=min_s vu_s/(ρ^D v_s)\), with \(v\) a positive right Perron eigenvector and \(ρ\) its eigenvalue for the adjacency matrix counting allowed letter transitions. A Lyndon word that begins with fewer than \(m\) zeros cannot contain \(0^m\) internally, so this bound accounts for all such Lyndon words. For a linearly avoiding Lyndon word beginning with \(0^m\) in those strongly connected cases, a fixed suffix gives an injective construction of a circularly avoiding Lyndon word. Use the empty suffix if \(f\) ends in a nonzero letter. If \(f\) ends in zero and a nonzero letter \(c\) differs from its first letter, append \(c^m\). In the remaining binary case, with \(f\) beginning in 1 and ending in 0, append \(1^m\) if \(f\) has more than two runs of identical letters, or append \(01\) if \(f=1^a0^d\) with \(a,d≥2\). For a suffix of length \(r\), deletion recovers the original word, and the number of possible images is bounded by \(L_c(t+r)≤ k^r I(t)/(t+r)\). For \(f=0^m\), linear avoidance already gives circular avoidance for Lyndon words of length \(t≥ m\). The two binary cases \(0ᵐ⁻¹1\) and \(01ᵐ⁻¹\) are covered by Sawada's earlier constant-amortised-time theorem for Lyndon forbidden words. The remaining positive binary case is \(f=1ᵐ⁻¹0\). For a linearly avoiding Lyndon word that fails the circular test, keep the prefix through the first 1 of its final run of ones. The Lyndon prefix of this shortened word avoids \(f\) circularly. Its letters and the shortened length determine the shortened word by repetition, and the original length determines how many ones to restore. Thus \(L_(t)≤ L_c(t)+∑1≤ <t∑1≤ p≤L_c(p)=O(I(t)/t)\), with \(\) and \(p\) the shortened length and Lyndon prefix length. The classification concerns one fixed forbidden word and the search and output checks in Figure 7.5.
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: