Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #29 Jan 31 2024 08:08:06
%S 1,0,3,-2,5,0,7,-6,9,0,11,-6,13,0,15,-14,17,0,19,-10,21,0,23,-18,25,0,
%T 27,-14,29,0,31,-30,33,0,35,-18,37,0,39,-30,41,0,43,-22,45,0,47,-42,
%U 49,0,51,-26,53,0,55,-42,57,0,59,-30,61,0,63,-62,65,0,67,-34,69,0,71,-54,73,0,75
%N a(n) = Sum_{d|n} (-1)^(d+1)*phi(d), where phi(n) = A000010(n).
%C Recall Gauss's identity Sum_{d|n} phi(d) = n.
%C a(n) is a multiplicative function of n since both (-1)^(n+1) and phi(n) are multiplicative functions of n.
%H Paolo Xausa, <a href="/A368744/b368744.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = -Sum_{k = 1..n} (-1)^(lcm(k, n)/k) = -Sum_{k = 1..n} (-1)^(n/gcd(k, n)).
%F a(2*n+1) = 2*n + 1; a(4*n+2) = 0.
%F Multiplicative: a(2^k) = 2 - 2^k and for odd prime p, a(p^k) = p^k.
%F Dirichlet g.f.: (1 - 3/2^s)/(1 - 1/2^s) * zeta(s-1).
%F From _Amiram Eldar_, Jan 31 2024: (Start)
%F a(n) = (2/A006519(n) - 1) * n.
%F Sum_{k=1..n} a(k) ~ n^2/6. (End)
%p with(numtheory): seq( add( (-1)^(d+1)*phi(d), d in divisors(n)), n = 1..75);
%t A368744[n_] := DivisorSum[n, (-1)^(#+1)*EulerPhi[#]&];
%t Array[A368744, 100] (* _Paolo Xausa_, Jan 30 2024 *)
%t a[n_] := (2^(1-IntegerExponent[n, 2]) - 1) * n ; Array[a, 100] (* _Amiram Eldar_, Jan 31 2024 *)
%o (PARI) a(n) = sumdiv(n, d, (-1)^(d+1)*eulerphi(d)); \\ _Michel Marcus_, Jan 30 2024
%o (PARI) a(n) = (2/(1<<valuation(n, 2)) - 1) * n; \\ _Amiram Eldar_, Jan 31 2024
%o (Python)
%o def A368744(n): return ((n<<1)>>(~n & n-1).bit_length())-n # _Chai Wah Wu_, Jan 30 2024
%Y Cf. A000010, A006519, A048272, A321543.
%K sign,mult,easy
%O 1,3
%A _Peter Bala_, Jan 21 2024