OFFSET
1,6
COMMENTS
From Robert Israel, Jul 23 2023: (Start)
a(n) = 0 if n is odd and squarefree.
a(n) = 1 if n is a square and not divisible by 16.
a(n) < 0 if n > 2 and n == 2 (mod 4).
a(n) = -2 if n = 2*p where p is an odd prime or the square of an odd prime.
(End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(6) = Sum_{d|6} (-1)^(d') = (-1)^(1') + (-1)^(2') + (-1)^(3') + (-1)^(6') = (-1)^0 + (-1)^1 + (-1)^1 + (-1)^5 = -2.
MAPLE
ader:= proc(n) option remember;
local t;
n*add(t[2]/t[1], t=ifactors(n)[2])
end proc:
f:= proc(n) local d; add ((-1)^ader(d), d = numtheory:-divisors(n)) end proc:
map(f, [$1..100]); # Robert Israel, Jul 23 2023
MATHEMATICA
d[1] = 0; d[n_] := n*Plus @@ ((Last[#]/First[#]) & /@ FactorInteger[n]); a[n_] := DivisorSum[n, (-1)^d[#] &]; Array[a, 100] (* Amiram Eldar, May 02 2022 *)
PROG
(PARI) ad(n) = vecsum([n/f[1]*f[2]|f<-factor(n+!n)~]); \\ A003415
a(n) = sumdiv(n, d, (-1)^ad(d)); \\ Michel Marcus, May 02 2022
CROSSREFS
KEYWORD
sign
AUTHOR
Wesley Ivan Hurt, May 01 2022
STATUS
approved