OFFSET
1,6
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
If i and j are coprime, a(i*j) = a(i)+a(j). - Robert Israel, Aug 27 2018
From Amiram Eldar, Oct 05 2023: (Start)
Additive with a(p^e) = (-1)^(e+1).
MAPLE
f:= proc(n) local F;
F:= map(t -> t[2], ifactors(n)[2]);
2*nops(select(type, F, odd))-nops(F);
end proc:
map(f, [$1..100]); # Robert Israel, Aug 27 2018
MATHEMATICA
Table[Total[-(-1)^If[n==1, {}, FactorInteger[n][[All, 2]]]], {n, 100}]
PROG
(PARI) a(n) = my(f=factor(n)); -sum(k=1, #f~, (-1)^(f[k, 2])); \\ Michel Marcus, Jul 08 2018; corrected Jun 13 2022
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Gus Wiseman, Jul 05 2018
STATUS
approved