login
Define Sophie Germain isolated primes to be primes p such that 2p+1 is also prime and so that p-2 and p+2 are not primes. The sequence contains Sophie Germain isolated primes p such that the previous prime to p and the succeeding prime to p are both also Sophie Germain isolated primes.
1

%I #10 Feb 22 2017 07:59:34

%S 103619,145109,291503,356591,362759,367733,475523,521831,527123,

%T 603191,609809,691979,726419,810809,812939,825491,940421,998213,

%U 1117793,1132811,1231889,1329143,1331789,1433891,1433903,1549403,1623059

%N Define Sophie Germain isolated primes to be primes p such that 2p+1 is also prime and so that p-2 and p+2 are not primes. The sequence contains Sophie Germain isolated primes p such that the previous prime to p and the succeeding prime to p are both also Sophie Germain isolated primes.

%H Harvey P. Dale, <a href="/A171162/b171162.txt">Table of n, a(n) for n = 1..1000</a>

%t f[n_]:=PrimeQ[2*n+1]&&!PrimeQ[n-2]&&!PrimeQ[n+2]; PrimeNext[n_]:=Module[{k},k=n+1;While[ !PrimeQ[k],k++ ];k]; PrimePrev[n_]:=Module[{k},k=n-1;While[ !PrimeQ[k],k-- ];k]; lst={};Do[p=Prime[n];If[f[p],If[f[PrimePrev[p]]&&f[PrimeNext[p]],AppendTo[lst,p]]],{n,9!}];lst

%t sgpQ[n_]:=Module[{nxt=NextPrime[n],prev=NextPrime[n,-1]},AllTrue[{2n+1, 2nxt+1, 2prev+1},PrimeQ]&&!PrimeQ[n+2]&&!PrimeQ[n-2]&&!PrimeQ[nxt+2] && !PrimeQ[nxt-2]&&!PrimeQ[prev+2]&&!PrimeQ[prev-2]]; Select[Prime[ Range[ 400000]],sgpQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Feb 21 2017 *)

%t Select[Partition[Prime[Range[100000]],5,1],Min[ Differences[#]]> 2 && AllTrue[ 2*#[[2;;4]]+1,PrimeQ]&][[All,3]] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Feb 22 2017 *)

%Y Cf. A005384, A007510, A130286

%K nonn

%O 1,1

%A _Vladimir Joseph Stephan Orlovsky_, Dec 04 2009

%E Definition rewritten by _Harvey P. Dale_, Feb 21 2017