Artificial intelligent assistant

Number of non periodic strings How many non-periodical strings of length N with letters from a to z exist? My only idea was something about prime factorization to find the amount of periodical strings of length N.

This is related to necklace polynomials.

Let $a_{kn}$ count the number of aperiodic strings of $n$ letters from an alphabet of $k$ letters. For each $d \mid N$, an aperiodic string of length $d$ gives rise to a string of length $N$ with period $d$, so the total number $k^N$ of strings of length $N$ with arbitrary period can be written as

$$ k^N = \sum_{d\mid N}a_{kd}\;. $$

Then Möbius inversion yields

$$ a_{kN} = \sum_{d\mid N}\mu\left(\frac Nd\right)k^d\;. $$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a2430073b52eaec22627ea2f8d5b79c2