OFFSET
1,3
COMMENTS
Total distance from n to each odd divisor of n.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
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