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.

A222548 a(n) = Sum_{k=1..n} floor(n/k)^2.

Original entry on oeis.org

1, 5, 11, 22, 32, 52, 66, 92, 115, 147, 169, 219, 245, 289, 333, 390, 424, 496, 534, 612, 672, 740, 786, 898, 957, 1037, 1113, 1219, 1277, 1413, 1475, 1595, 1687, 1791, 1883, 2056, 2130, 2246, 2354, 2526, 2608, 2792, 2878, 3040, 3190, 3330, 3424, 3662, 3773
Offset: 1

Views

Author

Benoit Cloitre, Feb 24 2013

Keywords

Comments

a(n) is the number of common divisors of integers 1<=i,j<=n over all ordered pairs (i,j). - Geoffrey Critzer, Jan 15 2015

References

  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 98.

Crossrefs

Similar sequences for Sum_{k=1..n} floor(n/k)^m: A006218 (m=1), this sequence (m=2), A318742 (m=3), A318743 (m=4), A318744 (m=5).

Programs

  • Magma
    [&+[Floor(n/k)^2:k in [1..n] ]: n in [1..40]]; // Marius A. Burtea, Jul 16 2019
    
  • Mathematica
    Table[Sum[Floor[n/k]^2, {k, n}], {n, 50}] (* T. D. Noe, Feb 26 2013 *)
    Table[nn = n;Total[Level[Table[Table[DivisorSigma[0, GCD[i, j]], {i, 1, nn}], {j, 1, nn}], {2}]], {n, 1, 49}] (* Geoffrey Critzer, Jan 15 2015 *)
    Table[Sum[2*DivisorSigma[1, k] - DivisorSigma[0, k], {k, 1, n}], {n, 1, 50}] (* Vaclav Kotesovec, Sep 02 2018 *)
  • PARI
    a(n)=sum(k=1,n,(n\k)^2)
    
  • Python
    from math import isqrt
    def A222548(n): return -(s:=isqrt(n))**3 + sum((q:=n//k)*((k<<1)+q-1) for k in range(1,s+1)) # Chai Wah Wu, Oct 21 2023

Formula

a(n) = zeta(2)*n^2 + O(n log n).
a(n) = 2*A024916(n) - A006218(n). - Vaclav Kotesovec, Sep 02 2018
G.f.: (1/(1 - x)) * Sum_{k>=1} (2*k - 1) * x^k/(1 - x^k). - Ilya Gutkovskiy, Jul 16 2019
a(n) = Sum_{d=1..n} (2*d-1)*floor(n/d). [Uspensky and Heaslet] - Michael Somos, Feb 16 2020
a(n) = Sum_{k=1..n} Sum_{d|k} floor(n/d). - Ridouane Oudra, Jul 16 2020
a(n) = Sum_{i=1..n} Sum_{j=1..n} tau(gcd(i,j)). - Ridouane Oudra, Nov 23 2021