login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Primes p such that at least one number remains prime when p is bracketed by a single digit d; that is, at least one instance of d//p//d is prime where // means concatenation.
1

%I #19 Feb 24 2023 20:21:41

%S 2,3,5,7,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,101,103,

%T 107,109,113,131,139,149,151,157,163,173,179,191,193,197,211,223,227,

%U 233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331

%N Primes p such that at least one number remains prime when p is bracketed by a single digit d; that is, at least one instance of d//p//d is prime where // means concatenation.

%C The bracketing digit d must be 1, 3, 7, or 9.

%H Michael S. Branicky, <a href="/A360781/b360781.txt">Table of n, a(n) for n = 1..10000</a>

%F Union of A069687, A069688, A069689, A069690. - _Alois P. Heinz_, Feb 22 2023

%e 263 is included because 263 is a prime and 32633 (and also 92639) is a prime.

%p q:= p-> ormap(isprime, map(d-> parse(cat(d, p, d)), [1, 3, 7, 9])):

%p select(q, [ithprime(i)$i=1..67])[]; # _Alois P. Heinz_, Feb 22 2023

%t brkQ[p_]:=AnyTrue[Table[FromDigits[Join[{d},IntegerDigits[p],{d}]],{d,{1,3,7,9}}],PrimeQ]; Select[Prime[Range[100]],brkQ]

%o (Python)

%o from sympy import isprime, nextprime

%o from itertools import islice

%o def agen(): # generator of terms

%o p = 2

%o while True:

%o sp = str(p)

%o if any(isprime(int(d+sp+d)) for d in "1379"):

%o yield p

%o p = nextprime(p)

%o print(list(islice(agen(), 57))) # _Michael S. Branicky_, Feb 20 2023

%o (PARI) is(p) = my(d=digits(p)); forstep(k=1, 9, 2, if (isprime(fromdigits(concat(k, concat(d,k)))), return(1)));

%o isok(p) = if (isprime(p), is(p)); \\ _Michel Marcus_, Feb 20 2023

%Y Cf. A000040, A059694, A069687, A069688, A069689, A069690.

%K nonn,base

%O 1,1

%A _Harvey P. Dale_, Feb 20 2023