login
Primes p such that p+2, p*(p+2)+18 and p*(p+2)+20 are also prime.
2

%I #20 Nov 13 2024 16:37:37

%S 419,2309,16631,17387,17597,22637,32297,49937,51239,61151,66947,

%T 122387,124907,136751,148721,148931,152459,182027,183917,189251,

%U 203909,209579,228521,246707,251789,291689,324617,371027,388961,408701,409289

%N Primes p such that p+2, p*(p+2)+18 and p*(p+2)+20 are also prime.

%H G. C. Greubel, <a href="/A130737/b130737.txt">Table of n, a(n) for n = 1..1000</a>

%p a:=proc(n)local p: p:=ithprime(n): if isprime(p+2)=true and isprime(p*(p+2)+18)=true and isprime(p*(p+2)+20)=true then p else end if end proc: seq(a(n),n= 1..40000); # _Emeric Deutsch_, Jul 28 2007

%t Select[Prime[Range[60000]], PrimeQ[#+2] && PrimeQ[#*(#+2)+18] && PrimeQ[#*(#+2)+20] &] (* _G. C. Greubel_, Mar 03 2019 *)

%o (PARI) {isok(n) = isprime(n) && isprime(n+2) && isprime(n*(n+2)+18) && isprime(n*(n+2)+20)};

%o forprime(n=1, 500000, if(isok(n), print1(n", "))) \\ _G. C. Greubel_, Mar 03 2019

%o (Magma) [n: n in [1..500000] | IsPrime(n) and IsPrime(n+2) and IsPrime(n*(n+2)+18) and IsPrime(n*(n+2)+20)]; // _G. C. Greubel_, Mar 03 2019

%o (Sage) [n for n in (1..500000) if is_prime(n) and is_prime(n+2) and is_prime(n*(n+2)+18) and is_prime(n*(n+2)+20)] # _G. C. Greubel_, Mar 03 2019

%o (GAP) Filtered([1..500000], k-> IsPrime(k) and IsPrime(k+2) and IsPrime(k*(k+2)+18) and IsPrime(k*(k+2)+20)); # _G. C. Greubel_, Mar 03 2019

%Y Cf. A001359, A130736.

%K nonn

%O 1,1

%A _Ray G. Opao_, Jul 06 2007

%E More terms from _Emeric Deutsch_, Jul 28 2007