%I #14 Jan 22 2024 01:24:03
%S 1,-1,0,0,-2,0,0,0,-1,2,0,0,-2,0,0,0,-2,1,0,0,0,0,0,0,1,2,0,0,-2,0,0,
%T 0,0,2,0,0,-2,0,0,0,-2,0,0,0,2,0,0,0,-1,-1,0,0,-2,0,0,0,0,2,0,0,-2,0,
%U 0,0,4,0,0,0,0,0,0,0,-2,2,0,0,0,0,0,0,0,2,0,0,4,0,0,0,-2,-2,0,0,0,0,0,0,-2,1,0,0,-2,0,0,0,0,2,0,0,-2,0,0,0,-2,0,0,0,2,0,0
%N Dirichlet inverse of A002654.
%H Andrew Howroyd, <a href="/A120630/b120630.txt">Table of n, a(n) for n = 1..1000</a>
%F Multiplicative function with a(p^e)=0 if e>2. a(2)=-1, a(4)=0. If p is a prime congruent to 3 modulo 4, then a(p)=0 and a(p^2)=-1. If p is a prime congruent to 1 modulo 4, then a(p)=-2 and a(p^2)=1.
%F Sum_{k=1..n} abs(a(k)) ~ c * n, where c = 3/(2*Pi*G) = 0.521269..., and G is Catalan's constant (A006752). - _Amiram Eldar_, Jan 22 2024
%e a(65)=4 because 65 is 5 times 13 and both of those primes are congruent to 1 modulo 4. Doubling an odd index yields the opposite of the value (e.g., a(130)=-4) because a(2)=-1. Doubling an even index yields zero.
%p A120630 := proc(n)
%p local a,pp;
%p if n = 1 then
%p 1;
%p else
%p a := 1 ;
%p for pp in ifactors(n)[2] do
%p if op(2,pp) > 2 then
%p a := 0;
%p elif op(1,pp) = 2 then
%p if op(2,pp) = 1 then
%p a := -a ;
%p else
%p a := 0 ;
%p end if;
%p elif modp(op(1,pp),4) = 3 then
%p if op(2,pp) = 1 then
%p a := 0 ;
%p else
%p a := -a ;
%p end if;
%p else
%p if op(2,pp) = 1 then
%p a := -2*a ;
%p else
%p ;
%p end if;
%p end if;
%p end do:
%p a;
%p end if;
%p end proc: # _R. J. Mathar_, Sep 15 2015
%t A120630[n_] := Module[{a, pp}, If[n == 1, 1, a = 1; Do[Which[pp[[2]] > 2, a = 0, pp[[1]] == 2, If[pp[[2]] == 1, a = -a, a = 0], Mod[pp[[1]], 4] == 3, If[pp[[2]] == 1, a = 0, a = -a], True, If[pp[[2]] == 1, a = -2*a]], {pp, FactorInteger[n]}]; a]]; Array[A120630, 120] (* _Jean-François Alcover_, Apr 24 2017, after _R. J. Mathar_ *)
%o (PARI) seq(n)={dirdiv(vector(n, n, n==1), vector(n, n, sumdiv( n, d, (d%4==1) - (d%4==3))))} \\ _Andrew Howroyd_, Aug 05 2018
%Y Cf. A002654, A006752, A023900, A046692, A053822, A053825, A053826, A101035.
%K mult,easy,sign
%O 1,5
%A _Gerard P. Michon_, Jun 25 2006
|