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.

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

Original entry on oeis.org

1, 3, 9, 12, 22, 30, 44, 48, 71, 83, 105, 115, 141, 157, 201, 206, 240, 266, 304, 318, 378, 402, 448, 460, 519, 547, 623, 641, 699, 747, 809, 815, 907, 943, 1035, 1064, 1138, 1178, 1286, 1302, 1384, 1448, 1534, 1560, 1710, 1758, 1852, 1866, 1977, 2039, 2179, 2209, 2315, 2395, 2535
Offset: 1

Views

Author

Seiichi Manyama, May 27 2021

Keywords

Crossrefs

Column k=2 of A344726.

Programs

  • Mathematica
    a[n_] := Sum[(-1)^(k + 1) * Quotient[n, k]^2, {k, 1, n}]; Array[a, 50] (* Amiram Eldar, May 27 2021 *)
    Accumulate[Table[-2*DivisorSigma[0, 2*n] + 3*DivisorSigma[0, n] + 2*DivisorSigma[1, 2*n] - 4*DivisorSigma[1, n], {n, 1, 50}]] (* Vaclav Kotesovec, May 28 2021 *)
  • PARI
    a(n) = sum(k=1, n, (-1)^(k+1)*(n\k)^2);
    
  • PARI
    a(n) = sum(k=1, n, sumdiv(k, d, (-1)^(k/d+1)*(2*d-1)));
    
  • PARI
    my(N=66, x='x+O('x^N)); Vec(sum(k=1, N, (2*k-1)*x^k/(1+x^k))/(1-x))

Formula

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