OFFSET
1,3
COMMENTS
Also number of ternary Lyndon words of trace 0 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)*mu(d)*3^(n/d) ).
EXAMPLE
a(4) = 6 = |{ 0012, 0021, 0111, 0102, 0222, 1122 }|.
MATHEMATICA
a[n_] := 1/(3n) DivisorSum[n, GCD[#, 3]*MoebiusMu[#]*3^(n/#)&]; Array[a, 32] (* Jean-François Alcover, Dec 06 2015, adapted from PARI *)
PROG
(PARI) a(n) = 1/(3*n) * sumdiv(n, d, gcd(d, 3)*moebius(d)*3^(n/d) ); /* Joerg Arndt, Aug 17 2012 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Frank Ruskey, Dec 13 1999
STATUS
approved