[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-83936-en":3,"doc-seo-83936-105":29,"detail-sidebar-cat-0-en-105":90},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},83936,1099514068035,"Ezra","https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c",8,"Research & Report","Necklaces and Lyndon words in colexicographic order","Constant-amortized-time algorithms generate all length-n necklaces and Lyndon words over a k-letter ordered alphabet in colexicographic order for any k≥2. The work introduces quasinecklaces as an efficiently generated superset that enables identifying all necklaces. A counting formula for the number Qk(n) of length-n quasinecklaces shows Qk(n) is proportional to the number of length-n necklaces, providing the key bound for constant amortized time. Applications include efficient generation of the Grandmama de Bruijn sequence and necklaces/Lyndon words under a weight constraint.","arXiv :2607 .05324v1 [math .CO] 6 Jul 2026  \nNecklaces and Lyndon words in colexicographic order  \nDaniel Gabri´c and Joe Sawada  \nSchool of Computer Science  \nUniversity of Guelph  \n50 Stone Road East  \nGuelph, ON N1G 2W1  \nCanada  \n[dgabric@uoguelph. ca](dgabric@uoguelph. ca)  \n[jsawada@uoguelph. ca](jsawada@uoguelph. ca)  \nAbstract  \nWe 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 ≥ 2. Our approach introduces a novel class of words called 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.  \nKeywords—Necklace, Lyndon word, colex order, Grandmama de Bruijn sequence, quasinecklace  \n1 Introduction  \nLet Σk denote the k-letter totally ordered alphabet {1 , 2 ,..., k} where 1 \u003C 2 \u003C ··· \u003C k. Throughout this paper, we implicitly assume all words have symbols from Σk . We call a word w a necklace 1 if it is, not necessarily uniquely, lexicographically smallest among all of its nontrivial rotations. The word w is a Lyndon word if it is strictly smaller than all of its nontrivial rotations. For example, the word 113213 is both a necklace and a Lyndon word, 121212 is a necklace but not a Lyndon word, and the word 12312 is neither a Lyndon word nor a necklace. Necklaces and Lyndon words are classical objects in combinatorics on words  \n1 Necklaces are also commonly referred to as equivalence classes of words under rotation.  \nand have many practical applications. For example, they appear in string algorithms [1 , 8], coding theory [12 , 13], bionformatics [3 , 15 , 17], and even music theory [6] .  \nThe study of necklaces and Lyndon words naturally raises the question of how to generate them efficiently. We call a generation algorithm constant amortized time (CAT) if the total work performed divided by the number of objects generated is bounded by a constant. Several CAT algorithms for generating necklaces and Lyndon words in lexicographic order are known. Fredricksen, Kessler, and Maiorana [10 , 11] presented the FKM algorithm, which generates necklaces in lexicographic order and was subsequently shown to be CAT by Ruskey et al. [18] . Duval [9] independently discovered a different lexicographic algorithm for necklaces, later proved to run in CAT by Berstel and Pocchiola [2] . Notably, the lexicographically least rotation of a de Bruijn sequence can be obtained by concatenating the Lyndon words generated by Duval’s algorithm.  \nAlthough necklaces and Lyndon words can already be efficiently generated in lexicographic order, some applications rely on different orderings. For example, the Grandmamade Bruijn sequence [7] is constructed by concatenating the primitive roots of all necklaces arranged in colexicographic (colex) order, and colex orderings of necklaces also arise in the construction of universal cycles for subsets [4] . Sawada et al. [19 , 20] introduced a CAT algorithm to generate binary necklaces in colex order. Their method relies on an auxiliary set of words called pseudonecklaces, which are easy to generate in colex order and whose cardinality is proportional to that of binary necklaces. For alphabets of size k ≥ 3, however, no such CAT generation algorithm has been available.  \nMain results. In this paper, we resolve this gap by presenting the first CAT algorithms for generating k-ary necklaces and Lyndon words in colex order for arbitrary k ≥ 2. To do so, we introduce a novel class of words called quasinecklaces. Quasinecklaces are similar in ","cbCailz6tNk56Nms","https://ap.wps.com/l/cbCailz6tNk56Nms","pdf",423192,1,21,"English","en",105,"# Introduction\n## Main results\n## Outline\n# Preliminaries\n## Notation and definitions\n# Quasinecklaces and CAT generation\n## Counting Qk(n)\n# Generating necklaces and Lyndon words in colex order\n## Running time and weight constraint\n# Applications\n## de Bruijn sequence and universal cycles","[{\"question\":\"What problem does the paper address for necklaces and Lyndon words?\",\"answer\":\"The paper targets efficient generation of all length-n necklaces and Lyndon words over a k-letter alphabet specifically in colexicographic order, achieving constant amortized time for any k≥2.\"},{\"question\":\"What are quasinecklaces and why are they introduced?\",\"answer\":\"Quasinecklaces form a novel word class that serves as an easily generated superset of necklaces, allowing all necklaces to be efficiently identified during generation.\"},{\"question\":\"How does the paper ensure constant amortized time?\",\"answer\":\"It derives a formula and bound for the number Qk(n) of length-n quasinecklaces and shows Qk(n) is proportional to the number of length-n necklaces, which is the key property used to obtain constant amortized time.\"}]",1784191546,53,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":85,"head_meta":87,"extra_data":89,"updated_unix":27},"necklaces-and-lyndon-words-in-colexicographic-order","",{"@graph":35,"@context":84},[36,53,67],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/necklaces-and-lyndon-words-in-colexicographic-order/83936/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":61,"encodingFormat":60,"isAccessibleForFree":62,"interactionStatistic":63},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-16",true,{"@type":64,"interactionType":65,"userInteractionCount":4},"InteractionCounter",{"@type":66},"ViewAction",{"@type":68,"mainEntity":69},"FAQPage",[70,76,80],{"name":71,"@type":72,"acceptedAnswer":73},"What problem does the paper address for necklaces and Lyndon words?","Question",{"text":74,"@type":75},"The paper targets efficient generation of all length-n necklaces and Lyndon words over a k-letter alphabet specifically in colexicographic order, achieving constant amortized time for any k≥2.","Answer",{"name":77,"@type":72,"acceptedAnswer":78},"What are quasinecklaces and why are they introduced?",{"text":79,"@type":75},"Quasinecklaces form a novel word class that serves as an easily generated superset of necklaces, allowing all necklaces to be efficiently identified during generation.",{"name":81,"@type":72,"acceptedAnswer":82},"How does the paper ensure constant amortized time?",{"text":83,"@type":75},"It derives a formula and bound for the number Qk(n) of length-n quasinecklaces and shows Qk(n) is proportional to the number of length-n necklaces, which is the key property used to obtain constant amortized time.","https://schema.org",{"og:url":51,"og:type":86,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":88,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":91},[92,96,100,104,109,114,119,122,127,130,134],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":93,"show_sort_weight":94,"slug":95},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":97,"show_sort_weight":98,"slug":99},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":101,"show_sort_weight":102,"slug":103},"Exam",70,"exam",{"id":105,"doc_module":4,"doc_module_name":45,"category_name":106,"show_sort_weight":107,"slug":108},5,"Comic",60,"comic",{"id":110,"doc_module":4,"doc_module_name":45,"category_name":111,"show_sort_weight":112,"slug":113},6,"Technology",50,"technology",{"id":115,"doc_module":4,"doc_module_name":45,"category_name":116,"show_sort_weight":117,"slug":118},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":120,"slug":121},30,"research-report",{"id":123,"doc_module":4,"doc_module_name":45,"category_name":124,"show_sort_weight":125,"slug":126},9,"Religion & Spirituality",20,"religion-spirituality",{"id":125,"doc_module":4,"doc_module_name":45,"category_name":128,"show_sort_weight":125,"slug":129},"World Cup","world-cup",{"id":131,"doc_module":4,"doc_module_name":45,"category_name":132,"show_sort_weight":131,"slug":133},10,"Lifestyle","lifestyle",{"id":135,"doc_module":4,"doc_module_name":45,"category_name":136,"show_sort_weight":105,"slug":137},19,"General","general"]