login
Primes p such that three of p+10, p+20, p+30 and p+40 are prime.
1

%I #12 Aug 04 2021 16:10:37

%S 3,7,13,31,43,73,97,127,241,307,349,379,409,547,577,643,937,1009,1021,

%T 1249,1399,1597,1627,1987,2341,2437,2647,2689,2887,3079,3517,3583,

%U 3793,3823,4201,4231,4243,4483,5839,6091,6133,6247,6679,6793,6961,7477,7507,8233,10303,12487,13219,13411,13681

%N Primes p such that three of p+10, p+20, p+30 and p+40 are prime.

%C Except for p=3, the three primes must be p+10, p+30 and p+40, because one of p, p+10, p+20 is divisible by 3, and one of p+20, p+30 and p+40 is divisible by 3.

%C All terms except 3 are == 1 (mod 3).

%H Robert Israel, <a href="/A342150/b342150.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3) = 13 is a term because 13, 23, 43 and 53 are all prime.

%p R:= 3: count:= 1:

%p for p from 7 by 6 while count < 300 do

%p if andmap(isprime,[p,p+10,p+30,p+40]) then

%p count:= count+1; R:= R, p

%p fi

%p od:

%p R;

%t Select[Prime[Range[2000]],Total[Boole[PrimeQ[#+{10,20,30,40}]]]==3&] (* _Harvey P. Dale_, Aug 04 2021 *)

%o (Python)

%o from sympy import isprime, primerange

%o def ok(p): return sum(isprime(p+i*10) for i in range(1, 5)) >= 3

%o def aupto(lim): return [p for p in primerange(1, lim+1) if ok(p)]

%o print(aupto(13681)) # _Michael S. Branicky_, Mar 02 2021

%K nonn

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Mar 01 2021