This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A050457 #36 Sep 27 2023 02:43:54 %S A050457 1,1,-2,1,6,-2,-6,1,7,6,-10,-2,14,-6,-12,1,18,7,-18,6,12,-10,-22,-2, %T A050457 31,14,-20,-6,30,-12,-30,1,20,18,-36,7,38,-18,-28,6,42,12,-42,-10,42, %U A050457 -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 %N A050457 a(n) = Sum_{ d divides n, d==1 mod 4} d - Sum_{ d divides n, d==3 mod 4} d. %C A050457 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 %H A050457 Indranil Ghosh, <a href="/A050457/b050457.txt">Table of n, a(n) for n = 1..5000</a> %H A050457 J. W. L. Glaisher, <a href="https://books.google.com/books?id=bLs9AQAAMAAJ&pg=RA1-PA1">On the representations of a number as the sum of two, four, six, eight, ten, and twelve squares</a>, Quart. J. Math. 38 (1907), 1-62 (see p. 4 and p. 8). %H A050457 <a href="/index/Ge#Glaisher">Index entries for sequences mentioned by Glaisher</a>. %F A050457 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 %F A050457 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 %F A050457 a(n) = Im(Sum_{d|n} d*i^d). - _Ridouane Oudra_, Feb 02 2020 %F A050457 a(n) = Sum_{d|n} d*sin(d*Pi/2). - _Ridouane Oudra_, Feb 18 2023 %p A050457 with(numtheory): %p A050457 A050457 := proc(n) %p A050457 local count1, count3, d; %p A050457 count1 := 0: %p A050457 count3 := 0: %p A050457 for d in numtheory[divisors](n) do %p A050457 if d mod 4 = 1 then %p A050457 count1 := count1+d %p A050457 elif d mod 4 = 3 then %p A050457 count3 := count3+d %p A050457 fi: %p A050457 end do: %p A050457 count1-count3; %p A050457 end proc: # _Ridouane Oudra_, Feb 02 2020 %p A050457 # second Maple program: %p A050457 a:= n-> add(`if`(d::odd, d*(-1)^((d-1)/2), 0), d=numtheory[divisors](n)): %p A050457 seq(a(n), n=1..100); # _Alois P. Heinz_, Feb 03 2020 %t A050457 Table[Sum[KroneckerSymbol[-4, d] d , {d, Divisors[n]}], {n, 71}] (* _Indranil Ghosh_, Mar 16 2017 *) %t A050457 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 *) %o A050457 (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 */ %o A050457 (PARI) {a(n)=if(n<1, 0, sumdiv(n, d, kronecker(-4, d)*d))} /* _Michael Somos_, May 29 2005 */ %Y A050457 Column k=1 of A322143. %K A050457 sign,easy,mult %O A050457 1,3 %A A050457 _N. J. A. Sloane_, Dec 23 1999