{"ID":5936952,"CreatedAt":"2026-07-07T03:14:33.014478982Z","UpdatedAt":"2026-07-09T16:45:10.440590912Z","DeletedAt":null,"paper_url":"https://arxiv.org/abs/2607.05324","arxiv_id":"2607.05324","title":"Necklaces and Lyndon words in colexicographic order","abstract":"We present the first constant-amortized-time algorithms for generating all length-$n$ necklaces and Lyndon words over a $k$-letter alphabet in colexicographic order, for arbitrary $k\\geq 2$. Our approach introduces a novel class of words called \\emph{quasinecklaces}, which serve as an easily generated superset of necklaces through which all necklaces can be efficiently identified. We derive a formula for the number $Q_k(n)$ of length-$n$ quasinecklaces and show that $Q_k(n)$ is proportional to the number of length-$n$ necklaces, which is the key property needed to achieve constant amortized time. We also apply our results to efficiently generate a well-known de Bruijn sequence and efficiently generate necklaces and Lyndon words subject to a weight constraint.","short_abstract":"We present the first constant-amortized-time algorithms for generating all length-$n$ necklaces and Lyndon words over a $k$-letter alphabet in colexicographic order, for arbitrary $k\\geq 2$. Our approach introduces a novel class of words called \\emph{quasinecklaces}, which serve as an easily generated superset of neckl...","url_abs":"https://arxiv.org/abs/2607.05324","url_pdf":"https://arxiv.org/pdf/2607.05324v1","authors":"[\"Daniel Gabric\",\"Joe Sawada\"]","published":"2026-07-06T17:00:56Z","proceeding":"math.CO","tasks":"[\"math.CO\",\"cs.DS\"]","methods":"[]","has_code":false}
