login
Primes p such that p*q + 6 and p*q - 6 are primes where p and q are consecutive primes.
1

%I #14 Jun 21 2017 19:07:26

%S 5,7,11,19,23,37,79,97,307,349,439,479,503,719,907,983,991,1061,1069,

%T 1109,1597,1609,1621,1867,2111,2609,3301,3371,3851,4129,4211,4639,

%U 4999,5119,5471,5683,5779,5867,5939,6563,7951,9337,9461,9551,10061,10181,10273,12251

%N Primes p such that p*q + 6 and p*q - 6 are primes where p and q are consecutive primes.

%H K. D. Bajpai, <a href="/A240621/b240621.txt">Table of n, a(n) for n = 1..1331</a>

%e 7 is in the sequence because 7*11 + 6 = 83 and 7*11 - 6 = 71 are both prime where 7 and 11 are consecutive primes.

%e 37 is in the sequence because 37*41 + 6 = 1523 and 37*41 - 6 = 1511 are both prime where 37 and 41 are consecutive primes.

%p KD := proc(n) local a,b,d; a:=ithprime(n)*ithprime(n+1); b:=a+6; d:=a-6; if isprime(b) and isprime(d) then RETURN (ithprime(n)); fi; end: seq(KD(n), n=1..5000);

%t Select[Partition[Prime[Range[1500]],2,1],AllTrue[Times@@#+{6,-6},PrimeQ]&][[All,1]] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Jun 21 2017 *)

%o (PARI) isok(p) = isprime(p) && (q = nextprime(p+1)) && isprime(p*q-6) && isprime(p*q+6); \\ _Michel Marcus_, Apr 12 2014

%Y Cf. A006094, A048880, A051507, A240596.

%K nonn

%O 1,1

%A _K. D. Bajpai_, Apr 09 2014