%I #63 Jan 30 2024 06:53:59
%S 0,1,1,0,1,0,1,1,0,0,1,1,1,0,0,0,1,1,1,1,0,0,1,0,0,0,1,1,1,1,1,1,0,0,
%T 0,0,1,0,0,0,1,1,1,1,1,0,1,1,0,1,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,1,1,1,
%U 0,1,1,1,1,0,1,1,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,1,1,1,0,1,1,1,0
%N Parity of Omega(n): a(n) = 1 if n is the product of an odd number of primes; 0 if product of even number of primes.
%C a(A026424(n)) = 1; a(A028260(n)) = 0.
%C From _Reinhard Zumkeller_, Jul 01 2009: (Start)
%C The first N Terms are constructed by the following sieving process:
%C for j:=1 until N do a(j):=0,
%C for i:=1 until N/2 do
%C for j:=2*i step i until N do a(j):=1-a(i). (End)
%C Omega is also written in the OEIS as bigomega. See also comments, references and formulas in A008836 (Liouville's lambda), A007421 and A065043, that all contain the same information as this sequence. - _Antti Karttunen_, Apr 30 2022
%H Antti Karttunen, <a href="/A066829/b066829.txt">Table of n, a(n) for n = 1..100000</a> (first 10000 terms from Reinhard Zumkeller)
%H S. Ramanujan, <a href="http://www.imsc.res.in/~rao/ramanujan/CamUnivCpapers/Cpaper4/page1.htm">Irregular numbers</a>, J. Indian Math. Soc., 5 (1913), 105-106; Coll. Papers 20-21 (provides Dirichlet g.f.)
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%H <a href="/index/Eu#epf">Index entries for sequences computed from exponents in factorization of n</a>
%H <a href="/index/Si#sieve">Index entries for sequences generated by sieves</a>
%F Dirichlet g.f.: (zeta(s)^2 - zeta(2*s)) / (2*zeta(s)). [Typo corrected by _Vaclav Kotesovec_, Jan 30 2024]
%F a(n) = (1-A008836(n)) / 2. - Corrected by _Antti Karttunen_, Apr 30 2022
%F a(m*n) = a(m) XOR a(n). - _Reinhard Zumkeller_, Aug 28 2008
%F a(n) = A001222(n) mod 2. - _Reinhard Zumkeller_, Nov 19 2011
%F From _Antti Karttunen_, May 01 & Nov 30 2022: (Start)
%F a(n) = 1 - A065043(n) = A349905(n) mod 2.
%F a(n) = A353556(n) + A353558(n).
%F a(n) = A358751(n) + A358753(n).
%F (End)
%e From _Reinhard Zumkeller_, Jul 01 2009: (Start)
%e Sieve for N = 30, also demonstrating the affinity to the Sieve of Eratosthenes:
%e [initial] a(j):=0, 1<=j<=30:
%e 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
%e [i=1] a(1)=0 --> a(j):=1, 2<=j<=30:
%e 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
%e [i=2] a(2)=1 --> a(2*j):=0, 2<=j<=[30/2]:
%e 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
%e [i=3] a(3)=1 --> a(3*j):=0, 2<=j<=[30/3]:
%e 0 1 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0
%e [i=4] a(4)=0 --> a(4*j):=1, 2<=j<=[30/4]:
%e 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 0 1 1 0
%e [i=5] a(5)=1 --> a(5*j):=0, 2<=j<=[30/5]:
%e 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 0 0 0 1 1 0 0 0 1 1 0
%e [i=6] a(6)=0 --> a(6*j):=1, 2<=j<=[30/6]:
%e 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 1
%e [i=7] a(7)=1 --> a(7*j):=0, 2<=j<=[30/7]:
%e 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 1
%e [i=8] a(8)=1 --> a(8*j):=0, 2<=j<=[30/8]:
%e 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 1 1
%e [i=9] a(9)=0 --> a(9*j):=1, 2<=j<=[30/9]:
%e 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 1
%e [i=10] a(10)=0 --> a(10*j):=1, 2<=j<=[30/10]:
%e 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 0 1 1
%e and so on: a(22):=0 in [i=11], a(24):=0 in [i=12], a(26):=0 in [i=13], a(28):=1 in [i=14], and a(30):=1 in [i=15]. (End)
%p A066829 := proc(n)
%p modp(numtheory[bigomega](n) ,2) ;
%p end proc:
%p seq(A066829(n),n=1..80) ; # _R. J. Mathar_, Jul 15 2017
%t Table[(1-LiouvilleLambda[n])/2,{n,1,20}] (* _Enrique PĂ©rez Herrero_, Jul 07 2012 *)
%t Table[If[OddQ[PrimeOmega[n]],1,0],{n,120}] (* _Harvey P. Dale_, Mar 12 2016 *)
%o (PARI) A066829(n) = (bigomega(n)%2); \\ Simplified by _Antti Karttunen_, Apr 30 2022
%o (Haskell)
%o a066829 = (`mod` 2) . a001222 -- _Reinhard Zumkeller_, Nov 19 2011
%o (Python)
%o from sympy import primeomega as Omega
%o def a(n): return Omega(n)%2
%o print([a(n) for n in range(1, 105)]) # _Michael S. Branicky_, Apr 30 2022
%o (Python)
%o from operator import ixor
%o from functools import reduce
%o from sympy import factorint
%o def A066829(n): return reduce(ixor, factorint(n).values(),0)&1 # _Chai Wah Wu_, Jan 01 2023
%Y Characteristic function of A026424 (positions of 1's). Cf. also A028260 (its complement, positions of 0's).
%Y Cf. A001222 (bigomega), A007421, A008836, A055038 (partial sums), A065043, A069545 (run lengths), A072203, A349905, A353556, A353558, A358751, A358753.
%K nonn,easy
%O 1,1
%A _G. L. Honaker, Jr._, Jan 17 2002
%E Corrected and comment added by _Reinhard Zumkeller_, Jun 26 2009