login
a(n) = Sum_{k=2..n} k*floor(n/k).
4

%I #23 Feb 18 2024 02:03:53

%S 2,5,11,16,27,34,48,60,77,88,115,128,151,174,204,221,259,278,319,350,

%T 385,408,467,497,538,577,632,661,732,763,825,872,925,972,1062,1099,

%U 1158,1213,1302,1343,1438,1481,1564,1641,1712,1759,1882,1938,2030,2101,2198,2251

%N a(n) = Sum_{k=2..n} k*floor(n/k).

%F G.f.: (1/(1 - x)) * Sum_{k>=2} k*x^k/(1 - x^k). - _Ilya Gutkovskiy_, Sep 02 2019

%t Table[Sum[k*Floor[n/k],{k,2,n}],{n,2,60}] (* _Harvey P. Dale_, Mar 13 2015 *)

%o (Magma) [&+[k*Floor(n/k): k in [2..n]]: n in [2..55]]; // _Bruno Berselli_, Jan 08 2012

%o (PARI) a(n) = sum(k=2,n, k*floor(n/k)); \\ _Michel Marcus_, Sep 02 2019

%o (Python)

%o from math import isqrt

%o def A024917(n): return (-(s:=isqrt(n))**2*(s+1)+sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1))>>1)-n # _Chai Wah Wu_, Oct 23 2023

%Y Cf. A002541, A024916, A345682.

%K nonn

%O 2,1

%A _Clark Kimberling_