A360781 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.
2, 3, 5, 7, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 101, 103, 107, 109, 113, 131, 139, 149, 151, 157, 163, 173, 179, 191, 193, 197, 211, 223, 227, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331
Offset: 1
Examples
263 is included because 263 is a prime and 32633 (and also 92639) is a prime.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Maple
q:= p-> ormap(isprime, map(d-> parse(cat(d, p, d)), [1, 3, 7, 9])): select(q, [ithprime(i)$i=1..67])[]; # Alois P. Heinz, Feb 22 2023
-
Mathematica
brkQ[p_]:=AnyTrue[Table[FromDigits[Join[{d},IntegerDigits[p],{d}]],{d,{1,3,7,9}}],PrimeQ]; Select[Prime[Range[100]],brkQ]
-
PARI
is(p) = my(d=digits(p)); forstep(k=1, 9, 2, if (isprime(fromdigits(concat(k, concat(d,k)))), return(1))); isok(p) = if (isprime(p), is(p)); \\ Michel Marcus, Feb 20 2023
-
Python
from sympy import isprime, nextprime from itertools import islice def agen(): # generator of terms p = 2 while True: sp = str(p) if any(isprime(int(d+sp+d)) for d in "1379"): yield p p = nextprime(p) print(list(islice(agen(), 57))) # Michael S. Branicky, Feb 20 2023
Comments