%I #69 Jun 18 2024 14:09:26
%S 1,-1,-1,0,-1,1,-1,1,0,1,-1,0,-1,1,1,-1,-1,0,-1,0,1,1,-1,-1,0,1,1,0,
%T -1,-1,-1,0,1,1,1,0,-1,1,1,-1,-1,-1,-1,0,0,1,-1,1,0,0,1,0,-1,-1,1,-1,
%U 1,1,-1,0,-1,1,0,1,1,-1,-1,0,1,-1,-1,0,-1,1,0,0,1
%N G.f.: Sum_{n>=1} a(n)*x^n/(1 - x^n) = Sum_{n>=1} x^(n^3).
%C Compare to Liouville's function lambda (A008836) which satisfies the Lambert series identity: Sum_{n>=1} lambda(n)*x^n/(1-x^n) = Sum_{n>=1} x^(n^2).
%C This is a multiplicative sequence with Dirichlet g.f. zeta(3s)/zeta(s) and inverse Mobius transform in A010057. - _R. J. Mathar_, Mar 31 2012
%H Paul D. Hanna, <a href="/A210826/b210826.txt">Table of n, a(n) for n = 1..1035</a>
%F a(n) == d(n) (mod 3), where d(n) is the number of divisors of n;
%F a(n) = 0 iff the number of divisors of n is divisible by 3 (A059269),
%F a(n) = 1 iff d(n) == 1 (mod 3),
%F a(n) = -1 iff d(n) == 2 (mod 3).
%F Multiplicative with a(p^e) = -1 + ((e+2) mod 3). Thus the Dirichlet g.f. is indeed zeta(3s)/zeta(s). Also sumdiv(n,d,a(d))=1 iff n is a cube, else sumdiv(n,d,a(d))=0 hence Sum_{k=1..n} a(k)*floor(n/k) = floor(n^(1/3)). - _Benoit Cloitre_, Oct 28 2012
%e G.f.: x/(1-x) - x^2/(1-x^2) - x^3/(1-x^3) - x^5/(1-x^5) + x^6/(1-x^6) - x^7/(1-x^7) + x^8/(1-x^8) + x^10/(1-x^10) - x^11/(1-x^11) + ... + a(n)*x^n/(1-x^n) + ...
%e = x + x^8 + x^27 + x^64 + x^125 + x^216 + x^343 + ... + x^(n^3) + ...
%p Z := proc(n,k)
%p local a,pf,e ;
%p a := 1 ;
%p for pf in ifactors(n)[2] do
%p e := pf[2] ;
%p if modp(e,k) = 0 then
%p ;
%p elif modp(e,k) = 1 then
%p a := -a ;
%p else
%p a := 0 ;
%p end if;
%p end do;
%p a;
%p end proc:
%p A210826 := proc(n)
%p Z(n,3) ;
%p end proc: # _R. J. Mathar_, May 28 2016
%t Mod[Table[DivisorSigma[0, n], {n, 1, 100}], 3, -1] (* _Geoffrey Critzer_, Mar 19 2015 *)
%o (PARI) {a(n) = if( n==0, 0, kronecker( -3, numdiv(n)))}; /* _Michael Somos_, Mar 28 2012 */
%o (PARI) {a(n)=[0,1,-1][numdiv(n)%3+1]} /* a(n) == d(n) (mod 3) */
%o (PARI) {a(n)=local(CUBES=sum(k=1, floor(n^(1/3)), x^(k^3))); if(n==1, 1, polcoeff(CUBES-sum(m=1, n-1, a(m)*x^m/(1-x^m+x*O(x^n))), n))}
%o (PARI) /* Vectorized form (faster): */
%o {A=[1]; for(i=1, 256, print1(A[#A], ", "); A=concat(A, 0); A[#A]=polcoeff(sum(k=1, ceil((#A)^(1/3)), x^(k^3)) - sum(m=1, #A-1, A[m]*x^m/(1-x^m+x*O(x^#A))), #A)); print1(A[#A])}
%o {sum(n=1, #A, A[n]*x^n/(1-x^n+O(x^(#A))))} /* Verify Lambert series */
%o (PARI) for(n=1, 100, print1(direuler(p=2, n, (1-X)/(1-X^3))[n], ", ")) \\ _Vaclav Kotesovec_, Jun 14 2020
%o (Python)
%o from math import prod
%o from sympy import factorint
%o def A210826(n): return prod((1,-1,0)[e%3] for e in factorint(n).values()) # _Chai Wah Wu_, Jun 18 2024
%Y Cf. A008836, A010057, A059269, A212793 (Dirichlet inverse), A219009.
%K sign,mult
%O 1,1
%A _Paul D. Hanna_, Mar 27 2012