OFFSET
1,2
COMMENTS
If p is prime, a(p^k) = (p^(2*k+2)-(2+k)*p^(k+1)+(k+1)*p^k)/(p - 1)^2.
If p < q are primes, a(p*q) = q*(p^2*q+2*p^2+2*p*q+4*p+q).
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
The divisors of 6 are 1,2,3,6, so a(6) = 6*(1+2+3+6)+3*(2+3+6)+2*(3+6)+1*6 = 129.
MAPLE
f:= proc(n) local D, S, i;
D:= sort(convert(numtheory:-divisors(n), list), `>`);
S:= ListTools:-PartialSums(D);
add(D[i]*S[-i], i=1..nops(D))
end proc:
map(f, [$1..100]);
MATHEMATICA
Array[Sum[#1[[k]]*Sum[#1[[j]], {j, #2 - k + 1, #2}], {k, #2}] & @@ {Divisors[#], DivisorSigma[0, #]} &, 54] (* Michael De Vlieger, Feb 05 2021 *)
PROG
(PARI) a(n) = my(d=divisors(n)); sum(k=1, #d, d[k]*sum(i=#d-k+1, #d, d[i])); \\ Michel Marcus, Feb 05 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Feb 05 2021
STATUS
approved