OFFSET
1,4
COMMENTS
Note that 1 does not have a square factor. - Antti Karttunen, Nov 20 2017
LINKS
FORMULA
From Amiram Eldar, Oct 01 2022: (Start)
a(n) = 0 iff n is squarefree (A005117).
a(n) = n iff n is a square of a prime (A001248).
Sum_{k=1..n} a(k) ~ (Pi^2/12 - 1/2) * n^2. (End)
EXAMPLE
a(8) = 12 = 4 + 8.
MATHEMATICA
Array[DivisorSum[#, # &, # (1 - MoebiusMu[#]^2) == # &] &, 86] (* Michael De Vlieger, Nov 20 2017 *)
a[1]=0; a[n_] := DivisorSigma[1, n] - Times@@(1+FactorInteger[n][[;; , 1]]); Array[a, 86] (* Amiram Eldar, Dec 20 2018 *)
PROG
(PARI) a(n)=sumdiv(n, d, d*(1-moebius(d)^2)); v=vector(300, n, a(n))
(Python)
from math import prod
from sympy import factorint
def A162296(n):
f = factorint(n)
return prod((p**(e+1)-1)//(p-1) for p, e in f.items())-prod(p+1 for p in f) # Chai Wah Wu, Apr 20 2023
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Joerg Arndt, Jun 30 2009
STATUS
approved