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.

A271342 Sum of all even divisors of all positive integers <= n.

Original entry on oeis.org

0, 2, 2, 8, 8, 16, 16, 30, 30, 42, 42, 66, 66, 82, 82, 112, 112, 138, 138, 174, 174, 198, 198, 254, 254, 282, 282, 330, 330, 378, 378, 440, 440, 476, 476, 554, 554, 594, 594, 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
Offset: 1

Views

Author

Omar E. Pol, Apr 08 2016

Keywords

Comments

a(n) is also the sum of all even divisors of all even positive integers <= n.
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
The bisection of this sequence equals twice A024916 (see formulas). - Michel Marcus, Dec 14 2017

Examples

			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.
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
		

Crossrefs

Programs

  • Mathematica
    Accumulate@ Array[DivisorSum[#, # &, EvenQ] &, 65] (* Michael De Vlieger, Jun 06 2017 *)
  • PARI
    a(n) = sum(k=1, n, sumdiv(k, d, (1-d%2)*d)); \\ Michel Marcus, Jun 05 2017
    
  • PARI
    a(n) = 2 * sum(k=1, n\2, k*(n\(k<<1))) \\ David A. Corneth, Jun 06 2017
    
  • Python
    def A271342(n): return sum(k*((n>>1)//k) for k in range(1, (n>>1)+1))<<1 # Chai Wah Wu, Apr 26 2023
    
  • Python
    from math import isqrt
    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

Formula

a(1) = 0.
a(n) = 2*A024916((n-1)/2), if n is odd and n > 1.
a(n) = 2*A024916(n/2), if n is even.
a(n) = A024916(n) - A078471(n).
For n > 1, a(2*n + 1) = a(2*n). - David A. Corneth, Jun 06 2017
a(n) = c * n^2 + O(n*log(n)), where c = Pi^2/24 = 0.411233... (A222171). - Amiram Eldar, Nov 27 2023