OFFSET
1,2
FORMULA
a(n) = Sum_{k=1..n} k * (ceiling(n/k^2) - floor(n/k^2)) * (1 - ceiling(n/k) + floor(n/k)).
EXAMPLE
a(16) = 24; The divisors of 16 whose square does not divide 16 are 8 and 16. The sum of the divisors is then 8 + 16 = 24.
MATHEMATICA
Table[Sum[k (Ceiling[n/k^2] - Floor[n/k^2]) (1 - Ceiling[n/k] + Floor[n/k]), {k, n}], {n, 80}]
PROG
(PARI) a(n) = sumdiv(n, d, if (n % d^2, d)); \\ Michel Marcus, Jun 13 2021
(Python 3.8+)
from math import prod
from sympy import factorint
def A345320(n):
f = factorint(n).items()
return (prod(p**(q+1)-1 for p, q in f) - prod(p**(q//2+1)-1 for p, q in f))//prod(p-1 for p, q in f) # Chai Wah Wu, Jun 14 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, Jun 13 2021
STATUS
approved