%I #48 Sep 18 2023 14:05:16
%S 0,0,2,5,7,12,17,24,26,29,36,47,52,65,74,82,84,101,106,125,132,142,
%T 155,178,183,188,203,206,215,244,254,285,287,301,320,332,337,374,395,
%U 411,418,459,471,514,527,535,560,607,612,619,626,646,661,714,719,735,744,766,797,856
%N a(n) = Sum_{k=1..n} prime(k)*floor(n/prime(k)).
%C For n > 2, sum of all distinct prime factors composing numbers from 2 to n.
%D M. Kalecki, On certain sums extended over primes or prime factors (in Polish), Prace Mat., Vol. 8 (1963/64), pp. 121-129.
%D József Sándor, Dragoslav S. Mitrinovic and Borislav Crstici, Handbook of Number Theory I, Springer Science & Business Media, 2005, Chapter IV, p. 144.
%H Vaclav Kotesovec, <a href="/A024924/b024924.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = n*A000720(n) - A024934(n). - _Max Alekseyev_, Feb 10 2012
%F a(n) = A034387([n/1]) + A034387([n/2]) + ... + A034387([n/n]). Terms can be computed efficiently with the following formula: a(n) = A034387([n/1]) + ... + A034387([n/m]) - m*A034387([n/m]) + Sum_{prime p<=n/m} p*[n/p], where m = [sqrt(n)]. - _Max Alekseyev_, Feb 10 2012
%F G.f.: Sum_{k >=1} (prime(k)*x^prime(k)/(1-x^prime(k)))/(1-x). - _Vladeta Jovovic_, Aug 11 2004
%F a(n) ~ ((Pi^2 + o(1))/12) * n^2/log(n) (Kalecki, 1963/64). - _Amiram Eldar_, Mar 04 2021
%t Join[{0}, Table[Sum[Prime[k] Floor[n / Prime[k]], {k, 1, n}], {n, 1, 60}]] (* _Vincenzo Librandi_, Jul 28 2019 *)
%t Join[{0}, Accumulate[Table[Sum[p, {p, Select[Divisors[n], PrimeQ]}], {n, 1, 100}]]] (* _Vaclav Kotesovec_, May 20 2020 *)
%o (PARI) a(n) = sum(k=1, n, prime(k)*(n\prime(k))); \\ _Michel Marcus_, Mar 01 2015
%o (PARI) a(n)=my(s); forprime(p=2,n, s+=n\p*p); s \\ _Charles R Greathouse IV_, Jun 26 2020
%o (Magma) [0] cat [ && +[ NthPrime(k)*Floor(n/NthPrime(k)): k in [1..n]]: n in [1..60]]; // _Vincenzo Librandi_, Jul 28 2019
%o (Python)
%o from sympy import prime
%o def A024924(n): return sum((p:=prime(k))*(n//p) for k in range(1,n+1)) # _Chai Wah Wu_, Sep 18 2023
%Y Partial sums of A008472.
%Y Cf. A000720, A024934, A034387.
%K nonn
%O 0,3
%A _Clark Kimberling_
%E a(0)=0 prepended by _Max Alekseyev_, Feb 10 2012