OFFSET
1,3
COMMENTS
Also number of ternary Lyndon words of trace 1 over GF(3).
Also number of ternary Lyndon words of trace 2 over GF(3).
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..2000
FORMULA
a(n) = 1/(3*n) * Sum_{d divides n, gcd(d, 3)=1} mu(d) * 3^{n/d}.
a(n) ~ 3^(n-1) / n. - Vaclav Kotesovec, Apr 18 2016
EXAMPLE
a(4)= 6 = |{ 0001, 0022, 0112, 0121, 0211, 1222 }|.
MATHEMATICA
a[n_] := 1/(3n) DivisorSum[n, If[GCD[#, 3] == 1, MoebiusMu[#]*3^(n/#), 0] &]; Array[a, 32] (* Jean-François Alcover, Dec 07 2015 *)
PROG
(PARI) a(n) = 1/(3*n) * sumdiv(n, d, if(gcd(d, 3)==1, moebius(d)*3^(n/d), 0 ) ); /* Joerg Arndt, Aug 17 2012 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Frank Ruskey, Dec 13 1999
STATUS
approved