OFFSET
1,2
COMMENTS
For each divisor d of n, add d if d is a square, otherwise add 1 [see example].
FORMULA
a(p) = 2 iff p is prime. - Wesley Ivan Hurt, Nov 28 2021
EXAMPLE
The divisors of 12 are 1, 2, 3, 4, 6, and 12 with squares 1 and 4, so a(12) = 1 + 1 + 1 + 4 + 1 + 1 = 9 (respectively).
MATHEMATICA
a[n_] := DivisorSum[n, If[IntegerQ @ Sqrt[#], #, 1] &]; Array[a, 100] (* Amiram Eldar, Nov 15 2021 *)
PROG
(PARI) a(n) = sumdiv(n, d, if (issquare(d), d, 1)); \\ Michel Marcus, Nov 15 2021
(PARI) a(n) = {my(f = factor(n), cf = f, res); cf[, 2]\=2; res = numdiv(f)-prod(i = 1, #f~, cf[i, 2]+1); res+=prod(i = 1, #f~, ((f[i, 1]^(2*(cf[i, 2]+1))-1)/(f[i, 1]^2-1))); res } \\ David A. Corneth, Nov 16 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, Nov 15 2021
STATUS
approved