|
|
A050457
|
|
a(n) = Sum_{ d divides n, d==1 mod 4} d - Sum_{ d divides n, d==3 mod 4} d.
|
|
5
|
|
|
1, 1, -2, 1, 6, -2, -6, 1, 7, 6, -10, -2, 14, -6, -12, 1, 18, 7, -18, 6, 12, -10, -22, -2, 31, 14, -20, -6, 30, -12, -30, 1, 20, 18, -36, 7, 38, -18, -28, 6, 42, 12, -42, -10, 42, -22, -46, -2, 43, 31, -36, 14, 54, -20, -60, -6, 36, 30, -58, -12, 62, -30, -42, 1, 84, 20, -66, 18, 44, -36, -70
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Multiplicative because it is the Inverse Moebius transform of [1 0 -3 0 5 0 -7 ...], which is multiplicative. - Christian G. Bower, May 18 2005
|
|
LINKS
|
|
|
FORMULA
|
a(n) is multiplicative with a(p^e)=1 if p=2, a(p^e)=(p^(e+1)-1)/(p-1) if p == 1 (mod 4), a(p^e)=((-p)^(e+1)-1)/(-p-1) if p == 3 (mod 4). - Michael Somos, May 29 2005
G.f.: Sum_{k>=1} (-1)^(k-1)*(2*k - 1)*x^(2*k-1)/(1 - x^(2*k-1)). - Ilya Gutkovskiy, Dec 22 2018
|
|
MAPLE
|
with(numtheory):
local count1, count3, d;
count1 := 0:
count3 := 0:
for d in numtheory[divisors](n) do
if d mod 4 = 1 then
count1 := count1+d
elif d mod 4 = 3 then
count3 := count3+d
fi:
end do:
count1-count3;
# second Maple program:
a:= n-> add(`if`(d::odd, d*(-1)^((d-1)/2), 0), d=numtheory[divisors](n)):
|
|
MATHEMATICA
|
Table[Sum[KroneckerSymbol[-4, d] d , {d, Divisors[n]}], {n, 71}] (* Indranil Ghosh, Mar 16 2017 *)
f[p_, e_] := If[Mod[p, 4] == 1, (p^(e+1)-1)/(p-1), ((-p)^(e+1)-1)/(-p-1)]; f[2, e_] := 1; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 27 2023 *)
|
|
PROG
|
(PARI) {a(n)=local(A, p, e); if(n<1, 0, A=factor(n); prod(k=1, matsize(A)[1], if(p=A[k, 1], e=A[k, 2]; if(p==2, 1, p*=kronecker(-4, p); (p^(e+1)-1)/(p-1)))))} /* Michael Somos, May 29 2005 */
(PARI) {a(n)=if(n<1, 0, sumdiv(n, d, kronecker(-4, d)*d))} /* Michael Somos, May 29 2005 */
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,easy,mult
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|