login
A367870
a(n) = Sum_{d|n, d odd} (n-d).
1
0, 1, 2, 3, 4, 8, 6, 7, 14, 14, 10, 20, 12, 20, 36, 15, 16, 41, 18, 34, 52, 32, 22, 44, 44, 38, 68, 48, 28, 96, 30, 31, 84, 50, 92, 95, 36, 56, 100, 74, 40, 136, 42, 76, 192, 68, 46, 92, 90, 119, 132, 90, 52, 176, 148, 104, 148, 86, 58, 216, 60, 92, 274, 63, 176, 216
OFFSET
1,3
COMMENTS
Total distance from n to each odd divisor of n.
LINKS
FORMULA
a(n) = A245579(n) - A000593(n).
a(n) = n*A001227(n) - A000593(n).
EXAMPLE
a(15) = 36. The total distance from 15 to each of its odd divisors is (15-1) + (15-3) + (15-5) + (15-15) = 36.
MAPLE
f:= proc(n) local x, d;
x:= n/2^padic:-ordp(n, 2);
add(n-d, d = numtheory:-divisors(x))
end proc:
map(f, [$1..100]); # Robert Israel, Dec 04 2023
MATHEMATICA
Table[DivisorSum[n, n-# &, OddQ], {n, 100}] (* Paolo Xausa, Mar 05 2024 *)
PROG
(PARI) a(n) = sumdiv(n, d, if (d%2, n-d)); \\ Michel Marcus, Dec 04 2023
(Python)
from math import prod
from sympy import factorint
def A367870(n):
f = factorint(n>>(~n&n-1).bit_length())
return n*prod(e+1 for e in f.values())-prod((p**(e+1)-1)//(p-1) for p, e in f.items()) # Chai Wah Wu, Dec 31 2023
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Wesley Ivan Hurt, Dec 03 2023
STATUS
approved