login

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

Numbers k such that exactly one of 2*k-1 and 2*k+1 is prime.
2

%I #10 May 06 2019 14:37:34

%S 1,4,5,7,8,10,11,12,14,16,18,19,20,22,23,24,26,27,29,31,33,34,35,37,

%T 39,40,41,42,44,45,48,49,50,52,53,55,56,57,63,64,65,66,68,70,74,76,78,

%U 79,81,82,83,84,86,87,89,91,95,97,98,100,105,106,111,112,113,115,116,117,119,121,125,126,128,129,131

%N Numbers k such that exactly one of 2*k-1 and 2*k+1 is prime.

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

%e a(1)=1 because 2*1-1=1 is nonprime and 2*1+1=3 is prime.

%p P:= [seq(ithprime(i),i=2..100)]:

%p PD:= P[2..-1]-P[1..-2]:

%p Q:= select(t -> PD[t]<>2, [$1..98]):

%p 1, op(map(i -> ((P[i]+1)/2, (P[i+1]-1)/2), Q)); # _Robert Israel_, May 06 2019

%t Select[Range[150],Sort[PrimeQ[2 #+{1,-1}]]=={False,True}&] (* _Harvey P. Dale_, Aug 21 2013 *)

%K nonn,easy,less

%O 1,2

%A _Juri-Stepan Gerasimov_, Mar 06 2010

%E Corrected by _Charles R Greathouse IV_, Mar 23 2010