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 A033664 #48 Feb 16 2025 08:32:36 %S A033664 2,3,5,7,13,17,23,37,43,47,53,67,73,83,97,103,107,113,137,167,173,197, %T A033664 223,283,307,313,317,337,347,353,367,373,383,397,443,467,503,523,547, %U A033664 607,613,617,643,647,653,673,683,743,773,797,823,853,883,907,937,947 %N A033664 Every suffix is prime. %C A033664 Primes in which repeatedly deleting the most significant digit gives a prime at every step until a single-digit prime remains. %C A033664 Every digit string containing the least significant digit is prime. - _Amarnath Murthy_, Sep 24 2003 %H A033664 Alois P. Heinz, <a href="/A033664/b033664.txt">Table of n, a(n) for n = 1..66973</a> (first 8779 terms from T. D. Noe) %H A033664 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TruncatablePrime.html">Truncatable Prime.</a> %p A033664 T:= proc(n) option remember; `if`(n=0, "", select(isprime, [seq(seq( %p A033664 seq(parse(cat(j, 0$(n-i), p)), p=[T(i-1)]), i=1..n), j=1..9)])[]) %p A033664 end: %p A033664 seq(T(n), n=1..4); # _Alois P. Heinz_, Sep 01 2021 %t A033664 h8pQ[n_]:=And@@PrimeQ/@Most[NestWhileList[FromDigits[Rest[ IntegerDigits[ #]]]&, n,#>0&]]; Select[Prime[Range[1000]],h8pQ] (* _Harvey P. Dale_, May 26 2011 *) %o A033664 (PARI) fileO="b033664.txt";lim=8779;v=vector(lim);v[1]=2;v[2]=3;v[3]=5;v[4]=7;j=4; write(fileO,"1 2");write(fileO,"2 3");write(fileO,"3 5");write(fileO,"4 7"); p10=1;until(0,p10*=10;j0=j;for(k=1,9,k10=k*p10; for(i=1,j0,if(j==lim,break(3));z=k10+v[i]; if(isprime(z),j++;v[j]=z;write(fileO,j," ",z);)))) \\ _Harry J. Smith_, Sep 20 2008 %o A033664 (Haskell) %o A033664 a033664 n = a033664_list !! (n-1) %o A033664 a033664_list = filter (all ((== 1) . a010051. read) . %o A033664 init . tail . tails . show) a000040_list %o A033664 -- _Reinhard Zumkeller_, Jul 10 2013 %o A033664 (Python) %o A033664 from sympy import isprime, primerange %o A033664 def ok(p): # does prime p satisfy the property %o A033664 s = str(p) %o A033664 return all(isprime(int(s[i:])) for i in range(1, len(s))) %o A033664 print(list(filter(ok, primerange(1, 1000)))) # _Michael S. Branicky_, Sep 01 2021 %o A033664 (Python) # alternate for going to large numbers %o A033664 def agen(maxdigits): %o A033664 yield from [2, 3, 5, 7] %o A033664 primestrs, digits, d = ["2", "3", "5", "7"], "0123456789", 1 %o A033664 while len(primestrs) > 0 and d < maxdigits: %o A033664 cands = set(d+p for p in primestrs for d in "0123456789") %o A033664 primestrs = [c for c in cands if c[0] == "0" or isprime(int(c))] %o A033664 yield from sorted(map(int, (p for p in primestrs if p[0] != "0"))) %o A033664 d += 1 %o A033664 print([p for p in agen(11)]) # _Michael S. Branicky_, Sep 01 2021 %Y A033664 Cf. A024785, A032437, A020994, A024770, A052023, A052024, A052025, A050986, A050987, A069866, A038680, A010051, A000040. %K A033664 nonn,base,easy,nice %O A033664 1,1 %A A033664 _N. J. A. Sloane_ %E A033664 More terms from _Erich Friedman_