OFFSET
1,4
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
FORMULA
From Amiram Eldar, Sep 24 2023: (Start)
a(n) >= 0, with equality if and only if n is squarefree (A005117).
EXAMPLE
a(4)=2 as cubefree(4)=4 and squarefree(4)=2. 4-2=2
MATHEMATICA
a[n_] := Module[{f = FactorInteger[n]}, Times @@ (First[#]^Min[Last[#], 2] & /@ f) - Times @@ (First[#] & /@ f)]; Array[a, 100] (* Amiram Eldar, Sep 24 2023 *)
PROG
(PARI) rad(n)=local(p, i); p=factor(n)[, 1]; prod(i=1, length(p), p[i])
rad2(n)=local(p, pn, i); p=factor(n)[, 1]; pn=factor(n)[, 2]; prod(i=1, length(p), p[i]^min(2, pn[i]))
for (k=1, 100, print1(rad2(k)-rad(k)", "))
(PARI) a(n) = {my(f = factor(n)); prod(i = 1, #f~, f[i, 1]^min(f[i, 2], 2)) - vecprod(f[, 1]); } \\ Amiram Eldar, Sep 24 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jon Perry, Nov 28 2002
STATUS
approved