OFFSET
1
COMMENTS
Characteristic sequence of A171821, which is complement of 2 together with the twin primes. (After the original name of the sequence)
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.
LINKS
FORMULA
a(n) = if n is found in A171821 then 0 else 1.
a(n) = 1 - A164292(n), for n > 2.
Recurrence:
t(1, 1) = 1;
t(2, 1) = 0;
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.
MATHEMATICA
(* 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]
PROG
(PARI) a(n)=if(isprime(n) && (isprime(n+2) || isprime(n-2)), 0, n!=2) \\ Charles R Greathouse IV, Mar 05 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Mats Granvik, Mar 04 2017
EXTENSIONS
More terms and new name from Antti Karttunen, Jan 03 2019
STATUS
approved