login
If n = Product (p_j^k_j) then a(n) = Sum ((-1)^(k_j + 1) * k_j).
2

%I #12 Oct 09 2023 02:16:45

%S 0,1,1,-2,1,2,1,3,-2,2,1,-1,1,2,2,-4,1,-1,1,-1,2,2,1,4,-2,2,3,-1,1,3,

%T 1,5,2,2,2,-4,1,2,2,4,1,3,1,-1,-1,2,1,-3,-2,-1,2,-1,1,4,2,4,2,2,1,0,1,

%U 2,-1,-6,2,3,1,-1,2,3,1,1,1,2,-1,-1,2,3,1,-3

%N If n = Product (p_j^k_j) then a(n) = Sum ((-1)^(k_j + 1) * k_j).

%C Sum of odd exponents in prime factorization of n minus the sum of even exponents in prime factorization of n.

%H Amiram Eldar, <a href="/A332423/b332423.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Eu#epf">Index entries for sequences computed from exponents in factorization of n</a>.

%F From _Amiram Eldar_, Oct 09 2023: (Start)

%F Additive with a(p^e) = (-1)^(e+1) * e.

%F a(n) = A350387(n) - A350386(n).

%F Sum_{k=1..n} a(k) ~ n * (log(log(n)) + B - C), where B is Mertens's constant (A077761) and C = Sum_{p prime} (3*p+1)/(p*(p+1)^2) = 0.81918453457738985491 ... . (End)

%e a(2700) = a(2^2 * 3^3 * 5^2) = -2 + 3 - 2 = -1.

%t a[n_] := Plus @@ ((-1)^(#[[2]] + 1) #[[2]] & /@ FactorInteger[n]); a[1] = 0; Table[a[n], {n, 1, 80}]

%o (PARI) a(n) = vecsum(apply(x -> (-1)^(x+1) * x, factor(n)[, 2])); \\ _Amiram Eldar_, Oct 09 2023

%Y Cf. A001222, A037916, A067255, A071321, A077761, A195017, A316523, A319273, A332422, A350386, A350387.

%K sign,easy

%O 1,4

%A _Ilya Gutkovskiy_, Feb 12 2020