The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 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 Indranil Ghosh, Table of n, a(n) for n = 1..5000 J. W. L. Glaisher, On the representations of a number as the sum of two, four, six, eight, ten, and twelve squares, Quart. J. Math. 38 (1907), 1-62 (see p. 4 and p. 8). Index entries for sequences mentioned by Glaisher. 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 a(n) = Im(Sum_{d|n} d*i^d). - Ridouane Oudra, Feb 02 2020 a(n) = Sum_{d|n} d*sin(d*Pi/2). - Ridouane Oudra, Feb 18 2023 MAPLE with(numtheory): A050457 := proc(n) 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; end proc: # Ridouane Oudra, Feb 02 2020 # second Maple program: a:= n-> add(`if`(d::odd, d*(-1)^((d-1)/2), 0), d=numtheory[divisors](n)): seq(a(n), n=1..100); # Alois P. Heinz, Feb 03 2020 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 Column k=1 of A322143. Sequence in context: A359273 A372909 A365048 * A195441 A338025 A239537 Adjacent sequences: A050454 A050455 A050456 * A050458 A050459 A050460 KEYWORD sign,easy,mult AUTHOR N. J. A. Sloane, Dec 23 1999 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified September 15 12:32 EDT 2024. Contains 375938 sequences. (Running on oeis4.)