login
A350146
Partial sums of A002131.
3
1, 3, 7, 11, 17, 25, 33, 41, 54, 66, 78, 94, 108, 124, 148, 164, 182, 208, 228, 252, 284, 308, 332, 364, 395, 423, 463, 495, 525, 573, 605, 637, 685, 721, 769, 821, 859, 899, 955, 1003, 1045, 1109, 1153, 1201, 1279, 1327, 1375, 1439, 1496, 1558, 1630, 1686, 1740, 1820
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
a(n) = A024916(n) - A024916(floor(n/2)). - Chai Wah Wu, 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