word with length $n$ is a word in $\mathcal A^n$ which is strictly smaller, for the lexicographic order, than each of its proper suffix: it is equivalent to say that a word $w$ with length $n$ is a Lyndon word if and only if it is strictly smaller for the lexicographic order than every $\tau^kw$ with $k
\in \{1, \dots, n-1\}$. We denote by $\mathcal L_n$ the set of Lyndon words with length $n$.

The group $<\tau>$ of cyclic permutations acts on $\mathcal A^n$, and $\mathcal P_n$ and $\mathcal N_n$ are stable under this action. Each orbit associated to a primitive word $w$ contains exactly $n$ distinct words, and a unique Lyndon word, denoted by $\rho(w)$, which is the smallest word in the orbit for the lexicographic order: the application $\rho$ is then the canonical projection of $\mathcal P_n$ on $\mathcal L_{n}$ associated to the action of $<\tau>$.

$\;$

$\bullet$ If $w=aabaaa$, then $\rho(w)=aaaaab$.

$\bullet$ If $A=\{aab,abb\}$ then ${{\rho}^{-1}}(A)=\{aab,aba,baa\}\cup\{abb,bab,bba\}$.

As the set $\mathcal N_n$ of non-primitive words contains no Lyndon word, we have, by the shepherd’s principle, that: $$card(\mathcal P_{n})= n \times card(\mathcal L_{n}).$$ Via the relation $card(\mathcal
P_n)=\sum_{d|n}{2^{n/d}\mu (d)},$ where $\mu$ is the M[ö]{}bius function (see the book by 