%I #49 Nov 27 2023 03:04:21
%S 0,2,2,8,8,16,16,30,30,42,42,66,66,82,82,112,112,138,138,174,174,198,
%T 198,254,254,282,282,330,330,378,378,440,440,476,476,554,554,594,594,
%U 678,678,742,742,814,814,862,862,982,982,1044,1044,1128,1128,1208,1208,1320,1320,1380,1380,1524,1524,1588,1588,1714,1714
%N Sum of all even divisors of all positive integers <= n.
%C a(n) is also the sum of all even divisors of all even positive integers <= n.
%C a(n) is also the total number of parts in all partitions of all positive integers <= n into an even number of equal parts. - _Omar E. Pol_, Jun 04 2017
%C The bisection of this sequence equals twice A024916 (see formulas). - _Michel Marcus_, Dec 14 2017
%H G. C. Greubel, <a href="/A271342/b271342.txt">Table of n, a(n) for n = 1..5000</a>
%F a(1) = 0.
%F a(n) = 2*A024916((n-1)/2), if n is odd and n > 1.
%F a(n) = 2*A024916(n/2), if n is even.
%F a(n) = A024916(n) - A078471(n).
%F For n > 1, a(2*n + 1) = a(2*n). - _David A. Corneth_, Jun 06 2017
%F a(n) = c * n^2 + O(n*log(n)), where c = Pi^2/24 = 0.411233... (A222171). - _Amiram Eldar_, Nov 27 2023
%e For n = 6 the divisors of all positive integers <= 6 are [1], [1, 2], [1, 3], [1, 2, 4], [1, 5], [1, 2, 3, 6] and the even divisors of all positive integers <= 6 are [2], [2, 4], [2, 6], so a(6) = 2 + 2 + 4 + 2 + 6 = 16. On the other hand the sum of all the divisors of all positive integers <= 6/2 are [1] + [1 + 2] + [1 + 3] = A024916(3) = 8, so a(6) = 2*8 = 16.
%e For n = 10, (floor(10/2) = 5) numbers have divisor 2, (floor(10/4) = 2) numbers have divisor 4, ..., (floor(10/10) = 1) numbers have divisor 10. Therefore, a(10) = 5 * 2 + 2 * 4 + 1 * 6 + 1 * 8 + 1 * 10 = 42. - _David A. Corneth_, Jun 06 2017
%t Accumulate@ Array[DivisorSum[#, # &, EvenQ] &, 65] (* _Michael De Vlieger_, Jun 06 2017 *)
%o (PARI) a(n) = sum(k=1, n, sumdiv(k, d, (1-d%2)*d)); \\ _Michel Marcus_, Jun 05 2017
%o (PARI) a(n) = 2 * sum(k=1, n\2, k*(n\(k<<1))) \\ _David A. Corneth_, Jun 06 2017
%o (Python)
%o def A271342(n): return sum(k*((n>>1)//k) for k in range(1, (n>>1)+1))<<1 # _Chai Wah Wu_, Apr 26 2023
%o (Python)
%o from math import isqrt
%o def A271342(n): return -(s:=isqrt(m:=n>>1))**2*(s+1) + sum((q:=m//k)*((k<<1)+q+1) for k in range(1,s+1)) # _Chai Wah Wu_, Oct 21 2023
%Y Cf. A000203, A006128, A024916, A078471, A146076, A222171, A271343.
%Y Partial sums of A146076.
%K nonn,easy
%O 1,2
%A _Omar E. Pol_, Apr 08 2016