%I #25 May 06 2022 15:25:31
%S 0,1,2,0,3,-1,4,1,0,-2,5,2,6,-3,-1,0,7,1,8,3,-2,-4,9,-1,0,-5,2,4,10,2,
%T 11,1,-3,-6,-1,0,12,-7,-4,-2,13,3,14,5,3,-8,15,2,0,1,-5,6,16,-1,-2,-3,
%U -6,-9,17,-1,18,-10,4,0,-3,4,19,7,-7,2,20,1,21,-11,2,8,-1,5,22,3,0,-12,23,-2,-4,-13,-8,-4,24
%N Signed sum over the prime indices of n.
%C If n = prime(x_1) * prime(x_2) * prime(x_3) * ... * prime(x_k) then a(n) = x_1 - x_2 + x_3 - ... + (-1)^(k-1) x_k, where the x_i are weakly increasing positive integers.
%C The value of a(n) depends only on the squarefree part of n, A007913(n). - _Antti Karttunen_, May 06 2022
%H Antti Karttunen, <a href="/A316524/b316524.txt">Table of n, a(n) for n = 1..16384</a>
%H <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a>
%F a(n) = A344616(n) * A344617(n) = a(A007913(n)). - _Antti Karttunen_, May 06 2022
%t Table[Sum[Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]][[k]]*(-1)^(k-1),{k,PrimeOmega[n]}],{n,100}]
%o (PARI) a(n) = {my(f = factor(n), vp = []); for (k=1, #f~, for( j=1, f[k,2], vp = concat (vp, primepi(f[k,1])));); sum(k=1, #vp, vp[k]*(-1)^(k+1));} \\ _Michel Marcus_, Jul 06 2018
%o (Python)
%o from sympy import factorint, primepi
%o def A316524(n):
%o fs = [primepi(p) for p in factorint(n,multiple=True)]
%o return sum(fs[::2])-sum(fs[1::2]) # _Chai Wah Wu_, Aug 23 2021
%Y Cf. A000040, A000607, A007913, A071321, A100118, A175352, A316313, A316523.
%Y Cf. A027746, A112798, A119899 (positions of negative terms).
%Y Cf. A344616 (absolute values), A344617 (signs).
%K sign
%O 1,3
%A _Gus Wiseman_, Jul 05 2018
%E More terms from _Antti Karttunen_, May 06 2022