A345320 Sum of the divisors of n whose square does not divide n.
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
Keywords
Examples
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.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Table[Sum[k (Ceiling[n/k^2] - Floor[n/k^2]) (1 - Ceiling[n/k] + Floor[n/k]), {k, n}], {n, 80}] sdnd[n_]:=Total[Select[Divisors[n],Mod[n,#^2]!=0&]]; Array[sdnd,100] (* Harvey P. Dale, Jul 07 2025 *)
-
PARI
a(n) = sumdiv(n, d, if (n % d^2, d)); \\ Michel Marcus, Jun 13 2021
-
Python
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
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) = Sum_{d|n} (d+d^(1/2)*((-1)^tau(d)-1)/2). - Wesley Ivan Hurt, Jul 07 2025
Comments