login
Primes p such that at least one of the two numbers p^2 - 6, p^2 + 6 is prime.
1

%I #15 Feb 10 2019 04:00:22

%S 3,5,7,11,13,17,19,23,31,47,53,61,67,73,79,83,89,97,107,109,113,131,

%T 151,167,193,197,199,263,269,293,317,331,367,373,383,401,431,457,463,

%U 467,487,503,557,569,593,607,643,647,673,677,683,709,773,787,797,823,827

%N Primes p such that at least one of the two numbers p^2 - 6, p^2 + 6 is prime.

%C p = 5 is the only term for which both p^2 - 6 and p^2 + 6 are primes.

%H G. C. Greubel, <a href="/A128925/b128925.txt">Table of n, a(n) for n = 1..10000</a>

%e 5^2 - 6 = 19 is prime (just as is 5^2+6 = 31), hence 5 is in the sequence.

%e 79^2 + 6 = 6241 + 6 = 6247 is prime, hence 79 is in the sequence.

%e 83^2 - 6 = 6889 - 6 = 6883 is prime, hence 83 is in the sequence.

%p a:=proc(n) if isprime(ithprime(n)^2+6)=true or isprime(ithprime(n)^2-6)=true then ithprime(n) else fi end: seq(a(n),n=1..200); # _Emeric Deutsch_, May 05 2007

%t Select[ Prime@ Range[2, 145], PrimeQ[ #^2 - 6] || PrimeQ[ #^2 + 6] &] (* _Robert G. Wilson v_, May 01 2007 *)

%o (PARI) {forprime(p=2, 830, s=p^2; if(isprime(s-6)||isprime(s+6), print1(p, ",")))} /* _Klaus Brockhaus_, May 06 2007 */

%Y Cf. A001248 (squares of primes).

%K nonn

%O 1,1

%A _J. M. Bergot_, Apr 25 2007

%E Edited and extended by _Robert G. Wilson v_, _Klaus Brockhaus_ and _Emeric Deutsch_, May 01 2007