Hi all,
From wikipedia:
In mathematics, in the areas of combinatorics and computer science, a Lyndon word is a string that is strictly smaller in lexicographic order than all of its rotations. Lyndon words are named after mathematician Roger Lyndon, who introduced them in 1954, calling them standard lexicographic sequences
For example [1,1,2,1,3] is a Lyndon word, but [1,3,1,1,2] is not.
I need to check as efficiently as possible if a given integer sequence is a Lyndon word or not. Is there such an option in sage?
I check the
section for Lyndon words in the manual but apparently the only way one can check something like that, is in a
situation like so:
sage: LyndonWord([2,1,2,3])
Traceback (most recent call last):
...
ValueError: Not a Lyndon word
Is this my only option for checking if something is a Lyndon word? This suggests that there is inherently some check in this
function, but I do not want to use a ValueError for that..
Any advice?
Thank you in advance