login
Primes p such that p*10+k is prime for exactly three values of the digit k.
4

%I #10 Apr 07 2023 12:01:08

%S 7,13,31,43,61,103,109,199,271,367,409,421,523,541,547,787,823,829,

%T 883,1009,1033,1117,1237,1291,1669,1999,2131,2161,2203,2269,2437,2503,

%U 2593,2671,2857,3049,3253,3271,3361,3559,3583,3769,3823,4003,4201,4339,4357

%N Primes p such that p*10+k is prime for exactly three values of the digit k.

%H Bruno Berselli, <a href="/A240680/b240680.txt">Table of n, a(n) for n = 1..1000</a>

%e 7 is in the sequence because 71, 73 and 79 are prime, but 77 is not prime.

%t Select[Prime[Range[600]],Total[Boole[PrimeQ[10#+{1,3,7,9}]]]==3&] (* _Harvey P. Dale_, Apr 07 2023 *)

%o (PARI) forprime(p=2, 10000, t=0; forstep(k=1, 9, 2, if(isprime(p*10+k), t++)); if(t==3, print1(p, ", ")))

%o (Magma) [p: p in PrimesUpTo(10^4) | {k: k in [1,3,7,9] | IsPrime(p*10+k)} in Subsets({1,3,7,9},3)]; // _Bruno Berselli_, Apr 10 2014

%Y Cf. A067267, A119289, A240678, A240679, A240689.

%K nonn,base

%O 1,1

%A _Colin Barker_, Apr 10 2014