OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..300
F. Ruskey, Necklaces, Lyndon words, De Bruijn sequences, etc. [Cached copy, with permission, pdf format only]
Eric Weisstein's World of Mathematics, Necklace
Wikipedia, Lyndon word
Wikipedia, Necklace (combinatorics)
FORMULA
a(n) ~ c * (n-1)!, where c = Product_{k>=2} 1/(1-1/k!) = A247551 = 2.52947747207915264818011615... . - Vaclav Kotesovec, Aug 27 2015
EXAMPLE
a(3) = 3: 001, 012, 021.
a(4) = 11: 0001, 0011, 0012, 0021, 0102, 0123, 0132, 0213, 0231, 0312, 0321.
MAPLE
with(numtheory):
b:= proc(n, i, g, d, j) option remember; `if`(g>0 and g<d, 0,
`if`(n=0, `if`(d=g, 1, 0), `if`(i<1, 0, b(n, i-1, g, d, j)+
`if`(i>n, 0, binomial(n/j, i/j)*b(n-i, i, igcd(i, g), d, j)))))
end:
a:= n-> `if`(n=0, 1, add(add((f-> `if`(f=0, 0, f*b(n$2, 0, d, j)))(
mobius(j)), j=divisors(d)), d=divisors(n))/n):
seq(a(n), n=0..25);
MATHEMATICA
b[n_, i_, g_, d_, j_] := b[n, i, g, d, j] = If[g>0 && g<d, 0, If[n==0, If[d == g, 1, 0], If[i<1, 0, b[n, i-1, g, d, j] + If[i>n, 0, Binomial[n/j, i/j]*b[n-i, i, GCD[i, g], d, j]]]]]; a[n_] := If[n==0, 1, Sum[Sum[ Function[f, If[f==0, 0, f*b[n, n, 0, d, j]]][MoebiusMu[j]], {j, Divisors[ d]}], {d, Divisors[n]}]/n]; Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Feb 22 2017, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 27 2015
STATUS
approved