OFFSET
1,2
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
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
M. Baake and R. V. Moody, Similarity submodules and root systems in four dimensions, arXiv:math/9904028 [math.MG], 1999.
M. Baake and R. V. Moody, Similarity submodules and root systems in four dimensions, Canad. J. Math. 51 (1999), 1258-1276.
FORMULA
a(n) = Sum_{k=1..n} A000593(k).
a(n) is asymptotic to c*n^2 where c = Pi^2/24.
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.
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 *)
PROG
(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
(Magma) [&+[&+[d:d in Divisors(k)|IsOdd(d)]:k in [1..n]]:n in [1..60]]; // Marius A. Burtea, Aug 28 2019
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Dec 31 2002
EXTENSIONS
Better definition from Omar E. Pol, Apr 09 2016
STATUS
approved