login
Numbers k such that k^3 +- 2 and k +- 2 are prime.
2

%I #26 Sep 08 2022 08:46:24

%S 129,1491,1875,2709,5655,6969,10335,14325,14421,17319,26559,35109,

%T 37509,43719,50229,52629,101871,102795,104325,105501,120429,127599,

%U 132699,136395,137829,157521,172425,173685,179481,186189,191829,211371,219681,221199,229215,234195

%N Numbers k such that k^3 +- 2 and k +- 2 are prime.

%C All terms in this sequence are divisible by 3.

%H Daniel Starodubtsev, <a href="/A329727/b329727.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 129:

%e 129^3 + 2 = 2146691;

%e 129^3 - 2 = 2146687;

%e 129 + 2 = 131;

%e 129 - 2 = 127; all four results are prime.

%e a(2) = 1491:

%e 1491^3 + 2 = 3314613773;

%e 1491^3 - 2 = 3314613769;

%e 1491 + 2 = 1493;

%e 1491 - 2 = 1489; all four results are prime.

%t Select[Range[500000], PrimeQ[#^3 + 2] && PrimeQ[#^3 - 2] && PrimeQ[# + 2] && PrimeQ[# - 2] &]

%o (Magma) [k:k in [1..250000]|forall{m:m in [-2,2]|IsPrime(k+m) and IsPrime(k^3+m)}]; // _Marius A. Burtea_, Nov 20 2019

%o (PARI) isok(k) = isprime(k-2) && isprime(k+2) && isprime(k^3-2) && isprime(k^3+2); \\ _Michel Marcus_, Nov 24 2019

%o (PARI) list(lim)=my(v=List(),p=127,k); forprime(q=131,lim+2,if(q-p==4 && isprime((k=p+2)^3-2) && isprime(k^3+2), listput(v,k)); p=q); Vec(v) \\ _Charles R Greathouse IV_, May 06 2020

%Y Intersection of A038599, A067200, and A087679.

%Y Cf. A040976, A052147, A090121, A268043, A268186.

%K nonn

%O 1,1

%A _K. D. Bajpai_, Nov 19 2019