Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #19 Apr 16 2022 16:47:25
%S 1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,
%T 1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,
%U 1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1
%N a(n) = 1 if the prime factorization of n contains as many even as odd prime indices, when counted with multiplicity, otherwise 0.
%C This is the characteristic function of A325698, see comments there.
%H Michael De Vlieger, <a href="/A353370/b353370.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%H <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a>
%F a(p) = 0 for all primes p.
%F a(n) = a(A003961(n)) = a(A348717(n)), for all n >= 1.
%F If a(x)+a(y) > 0, then a(x*y) = a(x)*a(y).
%e For n = 84 = 2 * 2 * 3 * 7 the condition is satisfied, because it has two instances of odd-indexed primes (A031368), namely (2*2), and also two instances (3 and 7) of the even-indexed primes (A031215), therefore a(84) = 1.
%t {1}~Join~Array[Boole[#2 == #1 - #2] & @@ {Length[#], Count[#, _?EvenQ]} &@ Flatten@ Apply[ConstantArray[PrimePi[#1], #2] &, FactorInteger[#], {1}] &, 121, 2] (* _Michael De Vlieger_, Apr 16 2022 *)
%o (PARI) A353370(n) = { my(f = factor(n)); (0==sum(i=1, #f~, f[i,2]*((-1)^(primepi(f[i, 1])%2)))); }; \\ _Antti Karttunen_, Apr 16 2022
%o (Python)
%o from sympy import factorint, primepi
%o def a(n):
%o v = [0, 0]
%o for p, e in factorint(n).items(): v[primepi(p)%2] += e
%o return int(v[0] == v[1])
%o print([a(n) for n in range(1, 123)]) # _Michael S. Branicky_, Apr 16 2022
%Y Characteristic function of A325698.
%Y Cf. A003961, A031215, A031368, A348717, A353371, A353372 (inverse Möbius transform), A353373.
%Y Cf. also A353331.
%K nonn
%O 1
%A _Antti Karttunen_, Apr 16 2022