OFFSET
1,1
COMMENTS
There are exactly 920720315 such primes, the largest being 9161759674286961988443272139114537477768682563429152377117139 1111313737919133977331737137933773713713973. - Karl W. Heuer, Apr 19 2011
There are exactly 331780864 odd length primes and 588939451 even length primes, the largest odd length prime being
7228828176786792552781668926755667258635743361825711373791931117197999133917737137399993737111177. - Seth A. Troisi, May 07 2019
Zeros are not permitted, otherwise this sequence would potentially be infinite (cf. A077391). - Sean A. Irvine, May 19 2025
LINKS
T. D. Noe, Table of n, a(n) for n = 1..12975
Carlos Rivera, Problem 950: Bi-truncatable primes, The Prime Puzzles & Problems Connection.
EXAMPLE
21313 is a member as 21313, 131 and 3 all are primes.
MATHEMATICA
msd={1, 2, 3, 4, 5, 6, 7, 8, 9}; lsd={1, 3, 7, 9}; Clear[p]; p[1]={2, 3, 5, 7}; p[2]={11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}; p[digits_] := p[digits] = Select[Flatten[Outer[Plus, 10^(digits-1)*msd, 10*p[digits-2], lsd]], PrimeQ]; t={}; k=0; While[Length[t] < 100, k++; t=Join[t, p[k]]]; t (* T. D. Noe, Apr 19 2011 *)
paesQ[n_]:=AllTrue[NestWhileList[FromDigits[Most[Rest[ IntegerDigits[ #]]]]&, n, #>99&], PrimeQ]; Select[Prime[Range[150]], paesQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Feb 01 2015 *)
PROG
(Python)
from itertools import count, islice
from sympy import isprime, primerange
def agen(): # generator of terms
odds, evens, digits = [2, 3, 5, 7], list(primerange(10, 100)), 3
yield from odds + evens
while len(odds) > 0 or len(evens) > 0:
new = []
old = odds if digits%2 == 1 else evens
for first in "123456789":
for p in old:
mid = str(p)
for last in "1379":
t = int(first + mid + last)
if isprime(t):
yield t
new.append(t)
old = new
if digits%2: odds = old
else: evens = old
digits += 1
print(list(islice(agen(), 80))) # Michael S. Branicky, May 06 2022
CROSSREFS
KEYWORD
base,fini,nonn
AUTHOR
Amarnath Murthy, Nov 07 2002
EXTENSIONS
Corrected and extended by T. D. Noe, Apr 19 2011
STATUS
approved
