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.

A078471 Sum of all odd divisors of all positive integers <= n.

Original entry on oeis.org

1, 2, 6, 7, 13, 17, 25, 26, 39, 45, 57, 61, 75, 83, 107, 108, 126, 139, 159, 165, 197, 209, 233, 237, 268, 282, 322, 330, 360, 384, 416, 417, 465, 483, 531, 544, 582, 602, 658, 664, 706, 738, 782, 794, 872, 896, 944, 948, 1005, 1036, 1108, 1122, 1176, 1216
Offset: 1

Views

Author

Benoit Cloitre, Dec 31 2002

Keywords

Comments

The subsequence of primes begins: 2, 7, 13, 17, 61, 83, 107, 139, 197, 233, then no more through a(54). [Jonathan Vos Post, Feb 14 2010]
a(n) is also the total number of parts in all partitions of all positive integers <= n into an odd number of equal parts. - Omar E. Pol, Jun 04 2017

Crossrefs

Partial sums of A000593.

Programs

  • Magma
    [&+[&+[d:d in Divisors(k)|IsOdd(d)]:k in [1..n]]:n in [1..60]]; // Marius A. Burtea, Aug 28 2019
    
  • Maple
    with(numtheory):
    b:= n-> add(d, d=select(x-> x::odd, divisors(n))):
    a:= proc(n) option remember; b(n)+`if`(n=1, 0, a(n-1)) end:
    seq(a(n), n=1..60);  # Alois P. Heinz, Sep 25 2015
  • Mathematica
    a[n_] := Sum[DivisorSum[k, (-1)^(# + 1) k/# &], {k, 1, n}]; Array[a, 60] (* Jean-François Alcover, Dec 07 2015 *)
    Accumulate[Table[Total[Select[Divisors[n],OddQ]],{n,60}]] (* Harvey P. Dale, Sep 15 2024 *)
  • PARI
    a(n)=sum(v=1,n,sumdiv(v,d,(-1)^(d+1)*v/d))
    
  • PARI
    a(n) = sum(k=1, n, sumdiv(k, d, (d%2)*d)); \\ Michel Marcus, Apr 09 2016
    
  • Python
    def A078471(n): return sum(k*(n//k) for k in range((n>>1)+1, n+1)) + sum(k*(n//k-((n>>1)//k<<1)) for k in range(1, (n>>1)+1)) # Chai Wah Wu, Apr 26 2023
    
  • Python
    from math import isqrt
    def A078471(n): return (t:=isqrt(m:=n>>1))**2*(t+1) - sum((q:=m//k)*((k<<1)+q+1) for k in range(1,t+1))-((s:=isqrt(n))**2*(s+1) - sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1))>>1) # Chai Wah Wu, Oct 21 2023

Formula

a(n) = Sum_{k=1..n} A000593(k).
a(n) is asymptotic to c*n^2 where c = Pi^2/24.
a(n) = A024916(n) - A271342(n). - Omar E. Pol, Apr 08 2016
G.f.: (1/(1 - x))*Sum_{k>=1} k*x^k/(1 + x^k). - Ilya Gutkovskiy, Dec 23 2016
From Ridouane Oudra, Aug 28 2019: (Start)
a(n) = Sum_{k=1..n} (sigma(2k) - 2*sigma(k)), where sigma = A000203.
a(n) = A326124(n) - 2*A024916(n). (End)

Extensions

Better definition from Omar E. Pol, Apr 09 2016