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.

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

Original entry on oeis.org

1, 0, 5, -4, 13, -16, 49, -88, 173, -324, 701, -1384, 2713, -5416, 10989, -21916, 43621, -87224, 174921, -349872, 698773, -1397356, 2796949, -5593872, 11183361, -22366976, 44742149, -89483716, 178951741, -357903312, 715838513, -1431678040, 2863290285
Offset: 1

Views

Author

Seiichi Manyama, May 29 2021

Keywords

Crossrefs

Column k=2 of A344824.
Cf. A081295.
Sums of the form Sum_{k=1..n} q^(k-1)*floor(n/k): A344820 (q=-n), A344819 (q=-4), A344818 (q=-3), this sequence (q=-2), A059851 (q=-1), A006218 (q=1), A268235 (q=2), A344814 (q=3), A344815 (q=4), A344816 (q=5), A332533 (q=n).

Programs

  • Magma
    A344817:= func< n | (&+[Floor(n/k)*(-2)^(k-1): k in [1..n]]) >;
    [A344817(n): n in [1..40]]; // G. C. Greubel, Jun 26 2024
    
  • Mathematica
    a[n_] := Sum[(-2)^(k - 1) * Quotient[n, k], {k, 1, n}]; Array[a, 30] (* Amiram Eldar, May 29 2021 *)
  • PARI
    a(n) = sum(k=1, n, n\k*(-2)^(k-1));
    
  • PARI
    a(n) = sum(k=1, n, sumdiv(k, d, (-2)^(d-1)));
    
  • PARI
    my(N=40, x='x+O('x^N)); Vec(sum(k=1, N, x^k/(1+2*x^k))/(1-x))
    
  • PARI
    my(N=40, x='x+O('x^N)); Vec(sum(k=1, N, (-2)^(k-1)*x^k/(1-x^k))/(1-x))
    
  • SageMath
    def A344817(n): return sum((n//k)*(-2)^(k-1) for k in range(1,n+1))
    [A344817(n) for n in range(1,41)] # G. C. Greubel, Jun 26 2024

Formula

a(n) = Sum_{k=1..n} Sum_{d|k} (-2)^(d-1).
G.f.: (1/(1 - x)) * Sum_{k>=1} x^k/(1 + 2*x^k).
G.f.: (1/(1 - x)) * Sum_{k>=1} (-2)^(k-1) * x^k/(1 - x^k).
a(n) ~ -(-1)^n * 2^n / 3. - Vaclav Kotesovec, Jun 05 2021