This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A077390 #52 May 19 2025 09:43:00 %S A077390 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89, %T A077390 97,127,131,137,139,151,157,173,179,223,227,229,233,239,251,257,271, %U A077390 277,331,337,353,359,373,379,421,431,433,439,457,479,521,523,557,571,577,631,653,659 %N 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. %C A077390 There are exactly 920720315 such primes, the largest being 9161759674286961988443272139114537477768682563429152377117139 1111313737919133977331737137933773713713973. - _Karl W. Heuer_, Apr 19 2011 %C A077390 There are exactly 331780864 odd length primes and 588939451 even length primes, the largest odd length prime being %C A077390 7228828176786792552781668926755667258635743361825711373791931117197999133917737137399993737111177. - _Seth A. Troisi_, May 07 2019 %C A077390 Zeros are not permitted, otherwise this sequence would potentially be infinite (cf. A077391). - _Sean A. Irvine_, May 19 2025 %H A077390 T. D. Noe, <a href="/A077390/b077390.txt">Table of n, a(n) for n = 1..12975</a> %H A077390 Carlos Rivera, <a href="https://www.primepuzzles.net/puzzles/puzz_950.htm">Problem 950: Bi-truncatable primes</a>, The Prime Puzzles & Problems Connection. %H A077390 Seth A. Troisi, <a href="/A077390/a077390.txt">Selected terms: the first 200 primes, the last 300 primes, and the smallest and largest primes of each length</a> %e A077390 21313 is a member as 21313, 131 and 3 all are primes. %t A077390 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 *) %t A077390 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 *) %o A077390 (Python) %o A077390 from itertools import count, islice %o A077390 from sympy import isprime, primerange %o A077390 def agen(): # generator of terms %o A077390 odds, evens, digits = [2, 3, 5, 7], list(primerange(10, 100)), 3 %o A077390 yield from odds + evens %o A077390 while len(odds) > 0 or len(evens) > 0: %o A077390 new = [] %o A077390 old = odds if digits%2 == 1 else evens %o A077390 for first in "123456789": %o A077390 for p in old: %o A077390 mid = str(p) %o A077390 for last in "1379": %o A077390 t = int(first + mid + last) %o A077390 if isprime(t): %o A077390 yield t %o A077390 new.append(t) %o A077390 old = new %o A077390 if digits%2: odds = old %o A077390 else: evens = old %o A077390 print("...", digits, time()-time0) %o A077390 digits += 1 %o A077390 print(list(islice(agen(), 80))) # _Michael S. Branicky_, May 06 2022 %Y A077390 Cf. A024770 (right-truncatable primes), A024785 (left-truncatable primes), A137812 (left-or-right truncatable primes). %Y A077390 Cf. A077391. %K A077390 base,fini,nonn %O A077390 1,1 %A A077390 _Amarnath Murthy_, Nov 07 2002 %E A077390 Corrected and extended by _T. D. Noe_, Apr 19 2011