A316523 Number of odd multiplicities minus number of even multiplicities in the canonical prime factorization of n.
0, 1, 1, -1, 1, 2, 1, 1, -1, 2, 1, 0, 1, 2, 2, -1, 1, 0, 1, 0, 2, 2, 1, 2, -1, 2, 1, 0, 1, 3, 1, 1, 2, 2, 2, -2, 1, 2, 2, 2, 1, 3, 1, 0, 0, 2, 1, 0, -1, 0, 2, 0, 1, 2, 2, 2, 2, 2, 1, 1, 1, 2, 0, -1, 2, 3, 1, 0, 2, 3, 1, 0, 1, 2, 0, 0, 2, 3, 1, 0, -1, 2, 1, 1
Offset: 1
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
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}]
-
PARI
a(n) = my(f=factor(n)); -sum(k=1, #f~, (-1)^(f[k,2])); \\ Michel Marcus, Jul 08 2018; corrected Jun 13 2022
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).