login
A345320
Sum of the divisors of n whose square does not divide n.
2
0, 2, 3, 4, 5, 11, 7, 12, 9, 17, 11, 25, 13, 23, 23, 24, 17, 35, 19, 39, 31, 35, 23, 57, 25, 41, 36, 53, 29, 71, 31, 56, 47, 53, 47, 79, 37, 59, 55, 87, 41, 95, 43, 81, 74, 71, 47, 117, 49, 87, 71, 95, 53, 116, 71, 117, 79, 89, 59, 165, 61, 95, 100, 112, 83, 143, 67, 123, 95, 143, 71, 183, 73, 113, 118, 137, 95, 167, 79, 179, 108, 125, 83
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)).
a(n) = A000203(n) - A069290(n). - Rémy Sigrist, Jun 14 2021
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