%I #64 Oct 06 2024 18:14:38
%S 1,0,0,0,0,0,2,0,2,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
%T 0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,4,0,0,0,2,0,
%U 0,0,0,0,2,0,0,0,0,0,2,0,0
%N Number of cubic primitive Dirichlet characters modulo n.
%C Also called primitive Dirichlet characters of order 3.
%C Mobius transform of A060839.
%C C. David, J. Fearnley & H. Kisilevsky prove that Sum_{k=1..n} a(k) ~ C*n, with C = (11*sqrt(3)/(18*Pi)) * Product_{primes p == 1 (mod 3)} (1 - 2/(p*(p+1))) = 0.3170565167922841205670156...; they credit Cohen, F. Diaz y Diaz, & M. Olivier 2002 (see Proposition 5.2. and Corollary 5.3.). - _Charles R Greathouse IV_, Aug 26 2009 [corrected by _Vaclav Kotesovec_, Sep 16 2020]
%C a(n) is the number of primitive Dirichlet characters modulo n such that all entries are 0 or a cubic root of unity: 1, w = (-1 + sqrt(3)*i)/2 or w^2 = (-1 - sqrt(3)*i)/2. - _Jianing Song_, Feb 27 2019
%C Every term is 0 or a power of 2. - _Jianing Song_, Mar 02 2019
%C From _Jianing Song_, Apr 03 2021: (Start)
%C For n >= 2, a(n) is the number of cyclic cubic fields with discriminant n^2. See A343023 for detailed information.
%C The first occurrence of 2^t is 9*A121940(t-1) for t >= 2. (End)
%H Jianing Song, <a href="/A160498/b160498.txt">Table of n, a(n) for n = 1..10000</a>
%H C. David, J. Fearnley and H. Kisilevsky,<a href="http://www.emis.de/journals/EM/expmath/volumes/13/13.html">On the vanishing of twisted L-functions of elliptic curves</a>, Experim. Math. 13 (2004) 185-198.
%H Steven R. Finch, <a href="https://web.archive.org/web/20160511040501/http://www.people.fas.harvard.edu/~sfinch/csolve/char.pdf">Cubic and quartic characters</a>.
%H Steven R. Finch, <a href="https://citeseerx.ist.psu.edu/pdf/d8a1c458d0bbb761a2110777aea6ab614d9a7467">Cubic and quartic characters</a>.
%H Steven R. Finch, <a href="https://arxiv.org/abs/0907.4894">Quartic and Octic Characters Modulo n</a>, arXiv:0907.4894 [math.NT], 2016.
%H Vaclav Kotesovec, <a href="/A160498/a160498.jpg">Plot of Sum_{k=1..n} a(k) / n for n = 1..10000000</a>
%F Multiplicative with a(p^e) = 2 if p^e = 9 or p == 1 (mod 3) and e = 1, otherwise 0. - _Jianing Song_, Mar 02 2019
%F a(n) = 2*A343023(n) for n >= 2. - _Jianing Song_, Apr 03 2021
%e From _Jianing Song_, Mar 02 2019: (Start)
%e Let w = (-1 + sqrt(3)*i)/2 be one of the primitive 3rd root of unity.
%e For n = 7, the 2 cubic primitive Dirichlet characters modulo n are [0, 1, w, w^2, w^2, w, 1] and [0, 1, w^2, w, w, w^2, 1], so a(7) = 2.
%e For n = 9, the 2 cubic primitive Dirichlet characters modulo n are [0, 1, w, 0, w^2, w^2, 0, w, 1] and [0, 1, w^2, 0, w, w, 0, w^2, 1], so a(9) = 2. (End)
%t A060839[n_] := Sum[If[Mod[k^3 - 1, n] == 0, 1, 0], {k, 1, n}]; a[n_] := Sum[ MoebiusMu[n/d]*A060839[d], {d, Divisors[n]}]; Table[a[n], {n, 2, 81}] (* _Jean-François Alcover_, Jun 19 2013 *)
%t f[3, 2] = 2; f[p_, e_] := If[Mod[p, 3] == 1 && e == 1, 2, 0]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Sep 16 2020 *)
%o (PARI) a(n)=sum(d=1, n, if(n%d==0, moebius(n/d)*sum(i=1, d, if((i^3-1)%d, 0, 1)), 0)) \\ _Steven Finch_, Jun 09 2009
%o (PARI) A005088(n)=my(f=factor(n)[,1]); sum(i=1,#f,f[i]%3==1)
%o A060839(n)=3^((n%9==0)+A005088(n))
%o a(n)=sumdiv(n,d,moebius(n/d)*A060839(d)) \\ _Charles R Greathouse IV_, Aug 26 2009
%o (PARI) a(n) = my(L=factor(n), w=omega(n)); for(i=1, w, if(!((L[i, 1]%3==1 && L[i, 2]==1) || L[i, 1]^L[i, 2] == 9), return(0))); 2^w \\ _Jianing Song_, Apr 03 2021
%Y Cf. A114643 (number of quadratic primitive Dirichlet characters modulo n), A160499 (number of quartic primitive Dirichlet characters modulo n).
%Y Cf. A060839 (number of solutions to x^3 == 1 (mod n)).
%Y Cf. A121940, A343023.
%K mult,nonn
%O 1,7
%A _Steven Finch_, May 15 2009
%E a(1) = 1 prepended by _Jianing Song_, Feb 27 2019