P311: Enumeration of all $k$-ary necklaces of length $n$ that have no substring equal to $f$

P311: Enumeration of all $k$-ary necklaces of length $n$ that have no substring equal to $f$
Input:
A $k$-ary string $f$ with length $m$, and a positive integer $n$.
Output:
All $k$-ary necklaces of length $n$ that have no substring equal to $f$.
Complexity:
$O(1)$ time per string.
Comment:
$f$ is an aperiodic necklace.
Reference:
[Ruskey2000a] (Bibtex)