cp's OEIS Frontend

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.

Showing 1-10 of 11 results. Next

A002129 Generalized sum of divisors function: excess of sum of odd divisors of n over sum of even divisors of n.

Original entry on oeis.org

1, -1, 4, -5, 6, -4, 8, -13, 13, -6, 12, -20, 14, -8, 24, -29, 18, -13, 20, -30, 32, -12, 24, -52, 31, -14, 40, -40, 30, -24, 32, -61, 48, -18, 48, -65, 38, -20, 56, -78, 42, -32, 44, -60, 78, -24, 48, -116, 57, -31, 72, -70, 54, -40, 72, -104, 80, -30, 60, -120, 62, -32, 104, -125
Offset: 1

Views

Author

Keywords

Comments

Glaisher calls this zeta(n) or zeta_1(n). - N. J. A. Sloane, Nov 24 2018
Coefficients in expansion of Sum_{n >= 1} x^n/(1+x^n)^2 = Sum_{n >= 1} (-1)^(n-1)*n*x^n/(1-x^n).
Unsigned sequence is A113184. - Peter Bala, Dec 14 2020

Examples

			a(28) = 40 because the sum of the even divisors of 28 (2, 4, 14 and 28) = 48 and the sum of the odd divisors of 28 (1 and 7) = 8, their absolute difference being 40.
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 162, #16, (6), 3rd formula.
  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, pp. 259-262.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A diagonal of A060044.
a(2^n) = -A036563(n+1). a(3^n) = A003462(n+1).
First differences of -A024919(n).

Programs

  • Maple
    A002129 := proc(n) -add((-1)^d*d,d=numtheory[divisors](n)) ; end proc: # R. J. Mathar, Mar 05 2011
  • Mathematica
    f[n_] := Block[{c = Divisors@ n}, Plus @@ Select[c, EvenQ] - Plus @@ Select[c, OddQ]]; Array[f, 64] (* Robert G. Wilson v, Mar 04 2011 *)
    a[n_] := DivisorSum[n, -(-1)^#*#&]; Array[a, 80] (* Jean-François Alcover, Dec 01 2015 *)
    f[p_, e_] := If[p == 2, 3 - 2^(e + 1), (p^(e + 1) - 1)/(p - 1)]; a[1] = 1; a[n_] := Times @@ (f @@@ FactorInteger[n]);  Array[a, 64] (* Amiram Eldar, Jul 20 2019 *)
  • PARI
    a(n)=if(n<1,0,-sumdiv(n,d,(-1)^d*d))
    
  • PARI
    {a(n)=n*polcoeff(log(sum(k=0,(sqrtint(8*n+1)-1)\2,x^(k*(k+1)/2))+x*O(x^n)),n)} \\ Paul D. Hanna, Jun 28 2008

Formula

Multiplicative with a(p^e) = 3-2^(e+1) if p = 2; (p^(e+1)-1)/(p-1) if p > 2. - David W. Wilson, Sep 01 2001
G.f.: Sum_{n>=1} n*x^n*(1-3*x^n)/(1-x^(2*n)). - Vladeta Jovovic, Oct 15 2002
L.g.f.: Sum_{n>=1} a(n)*x^n/n = log[ Sum_{n>=0} x^(n(n+1)/2) ], the log of the g.f. of A010054. - Paul D. Hanna, Jun 28 2008
Dirichlet g.f. zeta(s)*zeta(s-1)*(1-4/2^s). Dirichlet convolution of A000203 and the quasi-finite (1,-4,0,0,0,...). - R. J. Mathar, Mar 04 2011
a(n) = A000593(n)-A146076(n). - R. J. Mathar, Mar 05 2011
a(n) = Sum_{j = 1..n} Sum_{k = 1..j} (-1)^(j+1)*cos(2*k*n*Pi/j). - Peter Bala, Aug 24 2022
G.f.: Sum_{n>=1} n*(-x)^(n-1)/(1-x^n). - Mamuka Jibladze, Jun 03 2025

Extensions

Better description and more terms from Robert G. Wilson v, Dec 14 2000
More terms from N. J. A. Sloane, Mar 19 2001

A366915 a(n) = Sum_{k=1..n} (-1)^k*k^2*floor(n/k).

Original entry on oeis.org

-1, 2, -8, 11, -15, 15, -35, 48, -43, 35, -87, 103, -67, 83, -177, 162, -128, 145, -217, 277, -223, 143, -387, 443, -208, 302, -518, 432, -410, 370, -592, 771, -449, 421, -879, 850, -520, 566, -1134, 1024, -658, 842, -1008, 1310, -1056, 534, -1676, 1714, -737
Offset: 1

Views

Author

Chai Wah Wu, Oct 28 2023

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_]:=Sum[ (-1)^k*k^2*Floor[n/k],{k,n}]; Array[a,49] (* Stefano Spezia, Oct 29 2023 *)
  • PARI
    a(n) = sum(k=1, n, (-1)^k*k^2*(n\k)); \\ Michel Marcus, Oct 29 2023
  • Python
    from math import isqrt
    def A366915(n): return (-(t:=isqrt(m:=n>>1))**2*(t+1)*((t<<1)+1)+sum((q:=m//k)*(6*k**2+q*((q<<1)+3)+1) for k in range(1,t+1))<<2)//3+((s:=isqrt(n))**2*(s+1)*((s<<1)+1)-sum((q:=n//k)*(6*k**2+q*((q<<1)+3)+1) for k in range(1,s+1)))//6
    

Formula

a(n) = 8*A064602(floor(n/2))-A064602(n).

A366917 a(n) = Sum_{k=1..n} (-1)^k*k^3*floor(n/k).

Original entry on oeis.org

-1, 6, -22, 49, -77, 119, -225, 358, -399, 483, -849, 1139, -1059, 1349, -2179, 2500, -2414, 2885, -3975, 4971, -4661, 4663, -7505, 8819, -6932, 8454, -11986, 12438, -11952, 12744, -17048, 20399, -16897, 17501, -25843, 27904, -22750, 25270, -36274, 37184, -31738
Offset: 1

Views

Author

Chai Wah Wu, Oct 28 2023

Keywords

Crossrefs

Programs

  • Maple
    f:= proc(n) local k; add((-1)^k * k^3 * floor(n/k), k=1..n) end proc;
    map(f, [$1..100]); # Robert Israel, Dec 29 2023
  • Mathematica
    a[n_]:=Sum[ (-1)^k*k^3*Floor[n/k],{k,n}]; Array[a,41] (* Stefano Spezia, Oct 29 2023 *)
  • PARI
    a(n) = sum(k=1, n, (-1)^k*k^3*(n\k)); \\ Michel Marcus, Oct 29 2023
  • Python
    from math import isqrt
    def A366917(n): return (-(t:=isqrt(m:=n>>1))**3*(t+1)**2+sum((q:=m//k)*((k**3<<2)+q*(q*(q+2)+1)) for k in range(1,t+1))<<2)+((s:=isqrt(n))**3*(s+1)**2 - sum((q:=n//k)*((k**3<<2)+q*(q*(q+2)+1)) for k in range(1,s+1))>>2)
    

Formula

a(n) = 16*A064603(floor(n/2)) - A064603(n).

A366937 a(n) = Sum_{k=1..n} (-1)^(k-1) * binomial(k+1,2) * floor(n/k).

Original entry on oeis.org

1, -1, 6, -6, 10, -7, 22, -26, 26, -16, 51, -54, 38, -41, 101, -83, 71, -72, 119, -143, 123, -66, 211, -230, 111, -151, 279, -216, 220, -182, 315, -397, 237, -207, 467, -430, 274, -279, 599, -519, 343, -423, 524, -665, 557, -250, 879, -874, 380, -612, 874, -776
Offset: 1

Views

Author

Seiichi Manyama, Oct 29 2023

Keywords

Crossrefs

Partial sums of A320900.

Programs

  • PARI
    a(n) = sum(k=1, n, (-1)^(k-1)*binomial(k+1, 2)*(n\k));
    
  • Python
    from math import isqrt
    def A366937(n): return (((s:=isqrt(m:=n>>1))*(s+1)**2*((s<<2)+5)<<1)-(t:=isqrt(n))*(t+1)**2*(t+2)-sum((((q:=m//w)+1)*(q*((q<<2)+5)+6*w*((w<<1)+1))<<1) for w in range(1,s+1))+sum(((q:=n//w)+1)*(q*(q+2)+3*w*(w+1)) for w in range(1,t+1)))//6 # Chai Wah Wu, Oct 29 2023

Formula

G.f.: 1/(1-x) * Sum_{k>=1} x^k/(1+x^k)^3 = -1/(1-x) * Sum_{k>=1} binomial(k+1,2) * (-x)^k/(1-x^k).

A366938 a(n) = Sum_{k=1..n} (-1)^(k-1) * binomial(k+2,3) * floor(n/k).

Original entry on oeis.org

1, -2, 9, -14, 22, -27, 58, -85, 91, -97, 190, -243, 213, -266, 460, -499, 471, -553, 778, -970, 896, -845, 1456, -1697, 1264, -1560, 2270, -2289, 2207, -2307, 3150, -3793, 3049, -3125, 4765, -5079, 4061, -4492, 6634, -6714, 5628, -6370, 7821, -9120, 7986, -7013
Offset: 1

Views

Author

Seiichi Manyama, Oct 29 2023

Keywords

Crossrefs

Partial sums of A320901.

Programs

  • PARI
    a(n) = sum(k=1, n, (-1)^(k-1)*binomial(k+2, 3)*(n\k));
    
  • Python
    from math import isqrt
    def A366938(n): return (((s:=isqrt(m:=n>>1))*(s+1)**3*(s+2)<<4)-(t:=isqrt(n))*(t+1)**2*(t+2)*(t+3)-sum((((q:=m//w)+1)*(q*(q+1)*(q+2)+(w*(w+1)*((w<<1)+1)<<1))<<4) for w in range(1,s+1))+sum(((q:=n//w)+1)*(q*(q+2)*(q+3)+(w*(w+1)*(w+2)<<2)) for w in range(1,t+1)))//24 # Chai Wah Wu, Oct 29 2023

Formula

G.f.: 1/(1-x) * Sum_{k>=1} x^k/(1+x^k)^4 = -1/(1-x) * Sum_{k>=1} binomial(k+2,3) * (-x)^k/(1-x^k).

A366939 a(n) = Sum_{k=1..n} (-1)^(k-1) * binomial(k+3,4) * floor(n/k).

Original entry on oeis.org

1, -3, 13, -26, 45, -70, 141, -228, 283, -366, 636, -879, 942, -1232, 1914, -2331, 2515, -3090, 4226, -5313, 5539, -6114, 8837, -10558, 9988, -11947, 15969, -17705, 18256, -20364, 26013, -30592, 29330, -31874, 42222, -47034, 44357, -49602, 64164, -69115, 66637, -74017
Offset: 1

Views

Author

Seiichi Manyama, Oct 29 2023

Keywords

Crossrefs

Programs

  • PARI
    a(n) = sum(k=1, n, (-1)^(k-1)*binomial(k+3, 4)*(n\k));
    
  • Python
    from math import isqrt
    from sympy import rf
    def A366939(n): return ((rf(s:=isqrt(m:=n>>1),3)*(s+1)*((s**2<<2)+13*s+8)<<3)-rf(t:=isqrt(n),5)*(t+1)+sum((((q:=m//w)+1)*(-q*(q+2)*((q**2<<2)+13*q+8)-5*w*(w+1)*((r:=w<<1)+1)*(r+3))<<3) for w in range(1,s+1))+sum(rf(q:=n//w,5)+5*(q+1)*rf(w,4) for w in range(1,t+1)))//120 # Chai Wah Wu, Oct 29 2023

Formula

G.f.: 1/(1-x) * Sum_{k>=1} x^k/(1+x^k)^5 = -1/(1-x) * Sum_{k>=1} binomial(k+3,4) * (-x)^k/(1-x^k).

A309124 a(n) = n - 3 * floor(n/3) + 5 * floor(n/5) - 7 * floor(n/7) + ...

Original entry on oeis.org

1, 2, 0, 1, 7, 5, -1, 0, 7, 13, 3, 1, 15, 9, -3, -2, 16, 23, 5, 11, 23, 13, -9, -11, 20, 34, 14, 8, 38, 26, -4, -3, 17, 35, -1, 6, 44, 26, -2, 4, 46, 58, 16, 6, 48, 26, -20, -22, 21, 52, 16, 30, 84, 64, 4, -2, 34, 64, 6, -6, 56, 26, -16, -15, 69, 89, 23, 41, 85, 49, -21, -14, 60, 98, 36
Offset: 1

Views

Author

Ilya Gutkovskiy, Jul 13 2019

Keywords

Comments

Partial sums of A050457.

Crossrefs

Programs

  • Maple
    f:= proc(n) local r,d;
      r:= n/2^padic:-ordp(n,2);
      add((-1)^((d-1)/2)*d, d = numtheory:-divisors(r))
    end proc:
    ListTools:-PartialSums(map(f,[$1..100])); # Robert Israel, Oct 28 2020
  • Mathematica
    Table[Sum[(-1)^(k + 1) (2 k - 1) Floor[n/(2 k - 1)], {k, 1, n}], {n, 1, 75}]
    nmax = 75; CoefficientList[Series[1/(1 - x) Sum[(-1)^(k + 1) (2 k - 1) x^(2 k - 1)/(1 - x^(2 k - 1)), {k, 1, nmax}], {x, 0, nmax}], x] // Rest

Formula

G.f.: (1/(1 - x)) * Sum_{k>=1} (-1)^(k+1) * (2*k - 1) * x^(2*k-1)/(1 - x^(2*k-1)).

A366919 a(n) = Sum_{k=1..n} (-1)^k*k^n*floor(n/k).

Original entry on oeis.org

-1, 2, -22, 203, -2285, 33855, -609345, 12420372, -284964519, 7347342215, -209807114169, 6554034238459, -222469737401739, 8159109186320903, -321461264348047819, 13538455640979049698, -606976994365011212414, 28864017965496692865925, -1451086990386146504580735
Offset: 1

Views

Author

Chai Wah Wu, Oct 28 2023

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_]:=Sum[ (-1)^k*k^n*Floor[n/k],{k,n}]; Array[a,19] (* Stefano Spezia, Oct 29 2023 *)
  • PARI
    a(n) = sum(k=1, n, (-1)^k*k^n*(n\k)); \\ Michel Marcus, Oct 29 2023
  • Python
    from math import isqrt
    from sympy import bernoulli
    def A366919(n): return ((((s:=isqrt(m:=n>>1))+1)*(bernoulli(n+1)-bernoulli(n+1,s+1))<
    				

Formula

a(n) = (-1)^n*A308313(n).
Let A(n,k) = Sum_{j=1..n} j^k * floor(n/j). Then a(n) = 2^(n+1)*A(floor(n/2),n)-A(n,n).

A072663 Numbers m such that Sum_{k=1..m} (-1)^k*k*floor(m/k) = 0.

Original entry on oeis.org

2, 26, 28, 76, 210, 1801, 3508, 16180, 29286, 33988, 1161208, 4010473, 164048770, 18294479654
Offset: 1

Views

Author

Benoit Cloitre, Aug 10 2002

Keywords

Comments

It is easy to see that if f(n) = A024919(n) = Sum_{k=1..n} (-1)^k*k*floor(n/k) then f(n) = f(n-1) + (2^(L+1)-3)*sigma(M) if n=2^L*M, where M is odd and L >= 0. Using this we can get a faster program to calculate this sequence. - Robert Gerbicz, Aug 30 2002

Crossrefs

The zeros of A024919.

Programs

  • Mathematica
    f[n_] := Sum[(-1)^i*i*Floor[n/i], {i, 1, n}]; Do[s = f[n]; If[s == 0, Print[n]], {n, 1, 40000}]
  • PARI
    lista(nn) = {my(s=-1); for(m=2, nn, x=bitand(m, -m); if((s+=(2*x-3)*sigma(m/x)) == 0, print1(m, ", "))); } \\ Jinyuan Wang, Apr 06 2020

Extensions

Four more terms from Klaus Brockhaus, Aug 13 2002
More terms from Robert Gerbicz, Aug 30 2002
a(14) from Giovanni Resta, Apr 06 2020

A333505 a(n) = Sum_{k=1..n} (-1)^(k+1) * k * ceiling(n/k).

Original entry on oeis.org

1, 0, 2, 2, 2, 2, 5, 5, 1, 4, 9, 9, 2, 2, 9, 17, 5, 5, 11, 11, 2, 12, 23, 23, -4, 1, 14, 26, 15, 15, 22, 22, -6, 8, 25, 37, 9, 9, 28, 44, 7, 7, 18, 18, 3, 35, 58, 58, -9, -2, 18, 38, 21, 21, 36, 52, 5, 27, 56, 56, -3, -3, 28, 68, 8, 26, 45, 45, 24, 50, 73, 73, -23, -23, 14
Offset: 1

Views

Author

Ilya Gutkovskiy, May 25 2020

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Sum[(-1)^(k + 1) k Ceiling[n/k], {k, 1, n}], {n, 1, 75}]
    Table[(-1)^(n + 1) Ceiling[n/2] + Sum[DivisorSum[k, (-1)^(# + 1) # &], {k, 1, n - 1}], {n, 1, 75}]
    nmax = 75; CoefficientList[Series[x/(1 - x) (1/(1 + x)^2 + Sum[(-1)^(k + 1) k x^k/(1 - x^k), {k, 1, nmax}]), {x, 0, nmax}], x] // Rest
  • PARI
    a(n) = sum(k=1, n, (-1)^(k+1)*k*ceil(n/k)); \\ Michel Marcus, May 26 2020
    
  • Python
    from math import isqrt
    def A333505(n): return ((s:=isqrt(m:=n-1>>1))**2*(s+1)-sum((q:=m//k)*((k<<1)+q+1) for k in range(1,s+1))<<1)-((t:=isqrt(n-1))**2*(t+1)-sum((q:=(n-1)//k)*((k<<1)+q+1) for k in range(1,t+1))>>1) + (m+1 if n&1 else -m-1) # Chai Wah Wu, Oct 30 2023

Formula

G.f.: (x/(1 - x)) * (1/(1 + x)^2 + Sum_{k>=1} (-1)^(k+1) * k * x^k / (1 - x^k)).
a(n) = (-1)^(n+1) * ceiling(n/2) + Sum_{k=1..n-1} A002129(k).
a(n) = A001057(n) - A024919(n-1).
Showing 1-10 of 11 results. Next