OFFSET
1,2
FORMULA
a(n) = Sum_{k=1..n} Sum_{d|k, k/d odd} d = Sum_{k=1..n} A002131(k).
G.f.: (1/(1 - x)) * Sum_{k>=1} k * x^k/(1 - x^(2*k)).
a(n) ~ (Pi^2/16) * n^2. - Amiram Eldar, Dec 17 2021
MATHEMATICA
f[2, e_] := 2^e; f[p_, e_] := (p^(e + 1) - 1)/(p - 1); s[1] = 1; s[n_] := Times @@ f @@@ FactorInteger[n]; Accumulate @ Array[s, 50] (* Amiram Eldar, Dec 17 2021 *)
PROG
(PARI) a(n) = sum(k=1, n, sumdiv(k, d, k/d%2*d));
(PARI) my(N=66, x='x+O('x^N)); Vec(sum(k=1, N, k*x^k/(1-x^(2*k)))/(1-x))
(Python)
def A350146(n): return sum(k*(n//k) for k in range(1, n+1))-sum(k*(n//2//k) for k in range(1, n//2+1)) # Chai Wah Wu, Dec 17 2021
(Python)
from math import isqrt
def A350146(n): return (-(s:=isqrt(n))**2*(s+1) + sum((q:=n//k)*((k<<1)+q+1) for k in range(1, s+1))+(t:=isqrt(m:=n>>1))**2*(t+1) - sum((q:=m//k)*((k<<1)+q+1) for k in range(1, t+1)))>>1 # Chai Wah Wu, Oct 21 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Dec 16 2021
STATUS
approved