Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #11 May 14 2013 11:45:04
%S 2,3,23,503,991,1381,1621,3301,4211,5471,5683,6563,6581,7351,7369,
%T 7829,8179,8849,10061,11299,11789,13841,14389,15823,16981,17839,18199,
%U 20563,21089,24151,24989,25321,25609,26203,28001,28403,28433,32003,35671
%N Lesser of two consecutive primes, p < q, such that both p*q+p-q and p*q-p+q are prime numbers.
%C 2*3-1=5;2*3+1=7, 3*5-2=13;3*5+2=17, ...
%H Paolo P. Lava, <a href="/A154553/b154553.txt">Table of n, a(n) for n = 1..200</a>
%p with(numtheory); A154553:=proc(q) local a,b,n;
%p for n from 42676 to q do a:=ithprime(n); b:=nextprime(a);
%p if isprime(a*b+a-b) and isprime(a*b-a+b) then print(a);
%p fi; od; end: A154553(10^9); # _Paolo P. Lava_, May 14 2013
%t lst={};Do[p=Prime[n];pn=Prime[n+1];d=pn-p;If[PrimeQ[p*pn-d]&&PrimeQ[p*pn+d],AppendTo[lst,p]],{n,8!}];lst
%t pnQ[{p_,q_}]:=And@@PrimeQ[{p*q+p-q,p*q-p+q}]; Transpose[Select[ Partition[ Prime[Range[4000]],2,1],pnQ]][[1]] (* _Harvey P. Dale_, Jul 12 2012 *)
%Y Cf. A138111, A138170, A154550, A154551, A154552
%K nonn
%O 1,1
%A _Vladimir Joseph Stephan Orlovsky_, Jan 11 2009
%E Edited by _Omar E. Pol_, Jan 12 2009