login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A077390 Primes which leave primes at every step if most significant digit and least significant digit are deleted until a one digit or two digit prime is obtained. 7
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 127, 131, 137, 139, 151, 157, 173, 179, 223, 227, 229, 233, 239, 251, 257, 271, 277, 331, 337, 353, 359, 373, 379, 421, 431, 433, 439, 457, 479, 521, 523, 557, 571, 577, 631, 653, 659 (list; graph; refs; listen; history; text; internal format)
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
LINKS
C. 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
print("...", digits, time()-time0)
digits += 1
print(list(islice(agen(), 80))) # Michael S. Branicky, May 06 2022
CROSSREFS
cf. A024770 (right-truncatable primes), A024785 (left-truncatable primes), A137812 (left-or-right truncatable primes).
Sequence in context: A030475 A069676 A062353 * A069677 A069678 A069679
KEYWORD
base,fini,nonn
AUTHOR
Amarnath Murthy, Nov 07 2002
EXTENSIONS
Corrected and extended by T. D. Noe, Apr 19 2011
Crossref text fixed by Karl W. Heuer, Jan 31 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 11:35 EDT 2024. Contains 371912 sequences. (Running on oeis4.)