login
Numbers n such that n^3+prime(n) and n^3-prime(n) are prime.
1

%I #23 Aug 10 2023 13:43:51

%S 2,66,228,696,1416,2172,3000,3384,3732,4314,4524,4554,5070,5220,5412,

%T 5826,5844,6636,7422,7662,7932,8148,8832,9528,10092,10242,10746,11670,

%U 11682,11820,12918,13266,14430,14580,15216,15300,15534,15864,16542,16782,16932,17670

%N Numbers n such that n^3+prime(n) and n^3-prime(n) are prime.

%C All terms are even.

%H K. D. Bajpai, <a href="/A257788/b257788.txt">Table of n, a(n) for n = 1..6436</a>

%F Intersection of A141526 and A212881.

%e 2 is in the sequence: 2^3 + prime(2) = 11; 2^3 - prime(2) = 5; both are prime.

%e 66 is in the sequence: 66^3 + prime(66) = 287813; 66^3 - prime(66) = 287179; both are prime.

%t Select[Range[30000], PrimeQ[#^3 + Prime[#]] && PrimeQ[#^3 - Prime[#]] &]

%t Select[Range[18000],AllTrue[#^3+{Prime[#],-Prime[#]},PrimeQ]&] (* _Harvey P. Dale_, Aug 10 2023 *)

%o (PARI) for(n=1, 1e5, if(isprime(n^3 + prime(n)) && isprime(n^3 - prime(n)), print1(n,", ")))

%o (Magma) [n: n in [1..20000] | IsPrime(n^3+NthPrime(n)) and IsPrime(n^3-NthPrime(n))];

%Y Cf. A141526, A212881.

%K nonn

%O 1,1

%A _K. D. Bajpai_, May 12 2015