%I #21 Jan 04 2019 09:04:22
%S 1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,
%T 1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,
%U 1,1,0,1,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,0,1,0,1,1
%N a(n) = 1 if n is neither 2 nor a lesser or greater twin prime (in A001097), 0 otherwise.
%C Characteristic sequence of A171821, which is complement of 2 together with the twin primes. (After the original name of the sequence)
%C The recurrence for this sequence is essentially the sieve of Eratosthenes for the complement of A171821. It is possible to vary the recurrence to get the characteristic sequence of the complement of any prime constellation. The products in the recurrence are over the divisors.
%H Antti Karttunen, <a href="/A283265/b283265.txt">Table of n, a(n) for n = 1..65539</a>
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F a(n) = if n is found in A171821 then 0 else 1.
%F a(n) = 1 - A164292(n), for n > 2.
%F Recurrence:
%F t(1, 1) = 1;
%F t(2, 1) = 0;
%F t(n, k) = if n = k then 1 else if n > 2 then if k = 1 then (1 - (Product_{i = 2 .. n} t(n, i))*(Product_{i = 2 .. n - 2} t(n - 2, i)))*(1 - (Product_{i = 2 .. n} t (n, i))*Product_{i = 2 .. n + 2} (t(n + 2, i))) else if (mod (n, k) = 0 then t(n/k, 1) else 1) else 1.
%t (* Recurrence: *) Clear[t, n, k, i, nn]; nn = 90; t[1, 1] = 1; t[2, 1] = 0; t[n_, k_] := t[n, k] = If[n == k, 1, If[n > 2, If[k == 1, (1 - Product[t[n, i], {i, 2, n}]*Product[t[n - 2, i], {i, 2, n - 2}])*(1 - Product[t[n, i], {i, 2, n}]*Product[t[n + 2, i], {i, 2, n + 2}]), If[Mod[n, k] == 0, t[n/k, 1], 1], 1]]]; Monitor[a = Table[t[n, 1], {n, 1, nn}], n]
%o (PARI) a(n)=if(isprime(n) && (isprime(n+2) || isprime(n-2)), 0, n!=2) \\ _Charles R Greathouse IV_, Mar 05 2017
%Y Cf. A164292, A171821, A001097, A129950.
%K nonn
%O 1
%A _Mats Granvik_, Mar 04 2017
%E More terms and new name from _Antti Karttunen_, Jan 03 2019