login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = 1 if prime(n) + 2 is a prime, a(n) = -1 if prime(n) + 2 is a semiprime, otherwise 0.
1

%I #12 Sep 17 2018 20:13:50

%S -1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,0,-1,-1,1,0,-1,1,0,0,-1,-1,0,1,0,1,

%T -1,-1,-1,-1,1,-1,1,0,-1,0,-1,0,1,-1,1,0,1,-1,-1,0,1,0,-1,1,0,-1,-1,

%U -1,1,0,0,1,0,-1,-1,1,0,-1,0,-1,1,0,-1,-1,0,0,-1,0,-1,0,-1,-1,1,0,1,0,0,-1,-1,0,1,0,-1,-1,-1,-1

%N a(n) = 1 if prime(n) + 2 is a prime, a(n) = -1 if prime(n) + 2 is a semiprime, otherwise 0.

%H Robert Israel, <a href="/A106667/b106667.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = -1 because prime(1) = 2 and 2 + 2 = 4 is a semiprime;

%e a(2) = 1 because prime(2) = 3 and 3 + 2 = 5 is a prime;

%e a(14) = 0 because prime(14) = 43 and 43 + 2 = 45 is neither prime nor semiprime.

%p p:= 1:

%p for n from 1 to 100 do

%p p:= nextprime(p);

%p if isprime(p+2) then A[n]:=1

%p elif numtheory:-bigomega(p+2)=2 then A[n]:=-1

%p else A[n]:= 0

%p fi

%p od:

%p seq(A[n],n=1..100); # _Robert Israel_, Aug 29 2018

%Y Cf. A001359, A063637.

%K easy,sign,less

%O 1,1

%A _Giovanni Teofilatto_, May 13 2005

%E Corrected, and definition clarified, by _Robert Israel_, Aug 29 2018