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 A024770 #88 Jul 15 2025 11:35:45 %S A024770 2,3,5,7,23,29,31,37,53,59,71,73,79,233,239,293,311,313,317,373,379, %T A024770 593,599,719,733,739,797,2333,2339,2393,2399,2939,3119,3137,3733,3739, %U A024770 3793,3797,5939,7193,7331,7333,7393,23333,23339,23399,23993,29399,31193 %N A024770 Right-truncatable primes: every prefix is prime. %C A024770 Primes in which repeatedly deleting the least significant digit gives a prime at every step until a single-digit prime remains. The sequence ends at a(83) = 73939133 = A023107(10). %C A024770 The subsequence which consists of the following "chain" of consecutive right truncatable primes: 73939133, 7393913, 739391, 73939, 7393, 739, 73, 7 yields the largest sum, compared with other chains formed from subsets of this sequence: 73939133 + 7393913 + 739391 + 73939 + 7393 + 739 + 73 + 7 = 82154588. - _Alexander R. Povolotsky_, Jan 22 2008 %C A024770 Can also be seen as a table whose n-th row lists the n-digit terms; row lengths (0 for n >= 9) are given by A050986. The sequence can be constructed starting with the single-digit primes and appending, for each p in the list, the primes within 10*p and 10(p+1), formed by appending a digit to p. - _M. F. Hasler_, Nov 07 2018 %D A024770 Roozbeh Hazrat, Mathematica: A Problem-Centered Approach, Springer London 2010, pp. 86-89. %D A024770 James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 112-113. %H A024770 Jens Kruse Andersen, <a href="/A024770/b024770.txt">Table of n, a(n) for n = 1..83</a> (The full list of terms, taken from link below) %H A024770 Jens Kruse Andersen, <a href="http://primerecords.dk/right-truncatable.txt">Right-truncatable primes</a> %H A024770 I. O. Angell and H. J. Godwin, <a href="http://dx.doi.org/10.1090/S0025-5718-1977-0427213-2">On Truncatable Primes</a>, Math. Comput. 31, 265-267, 1977. %H A024770 Patrick De Geest, <a href="http://www.worldofnumbers.com/truncat.htm">The list of 4260 left-truncatable primes</a> %H A024770 R. Schroeppel, <a href="http://www.inwap.com/pdp10/hbaker/hakmem/number.html#item33">HAKMEM item 33</a>; "Russian Doll Primes", but with a slightly different definition. %H A024770 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TruncatablePrime.html">Truncatable Prime</a> %H A024770 <a href="/index/Tri#tprime">Index entries for sequences related to truncatable primes</a> %p A024770 s:=[1,3,7,9]: a:=[[2],[3],[5],[7]]: l1:=1: l2:=4: do for j from l1 to l2 do for k from 1 to 4 do d:=[s[k],op(a[j])]: if(isprime(op(convert(d, base, 10, 10^nops(d)))))then a:=[op(a), d]: fi: od: od: l1:=l2+1: l2:=nops(a): if(l1>l2)then break: fi: od: seq(op(convert(a[j], base, 10, 10^nops(a[j]))),j=1..nops(a)); # _Nathaniel Johnston_, Jun 21 2011 %t A024770 max = 100000; truncate[p_] := If[PrimeQ[q = Quotient[p, 10]], q, p]; ok[p_] := FixedPoint[ truncate, p] < 10; p = 1; A024770 = {}; While[ (p = NextPrime[p]) < max, If[ok[p], AppendTo[ A024770, p]]]; A024770 (* _Jean-François Alcover_, Nov 09 2011, after Pari *) %t A024770 eppQ[n_]:=AllTrue[FromDigits/@Table[Take[IntegerDigits[n],i],{i, IntegerLength[ n]-1}], PrimeQ]; Select[Prime[Range[3400]],eppQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Jan 14 2015 *) %o A024770 (Haskell) %o A024770 import Data.List (inits) %o A024770 a024770 n = a024770_list !! (n-1) %o A024770 a024770_list = filter (\x -> %o A024770 all (== 1) $ map (a010051 . read) $ tail $ inits $ show x) a038618_list %o A024770 -- _Reinhard Zumkeller_, Nov 01 2011 %o A024770 (PARI) {fileO="b024770.txt";v=vector(100);v[1]=2;v[2]=3;v[3]=5;v[4]=7;j=4;j1=1; write(fileO,"1 2");write(fileO,"2 3");write(fileO,"3 5");write(fileO,"4 7"); until(0,if(j1>j,break);new=1;for(i=j1,j,if(new,j1=j+1;new=0);for(k=1,9, z=10*v[i]+k;if(isprime(z),j++;v[j]=z;write(fileO,j," ",z);))));} \\ _Harry J. Smith_, Sep 20 2008 %o A024770 (PARI) for(n=2, 31193, v=n; while(isprime(n), c=n; n=(c-lift(Mod(c, 10)))/10); if(n==0, print1(v, ", ")); n=v); \\ _Arkadiusz Wesolowski_, Mar 20 2014 %o A024770 (PARI) A024770=vector(9, n, p=concat(apply(t->primes([t, t+1]*10), if(n>1, p)))) \\ The list of n-digit terms, 1 <= n <= 9. Use concat(%) to "flatten" it. - _M. F. Hasler_, Nov 07 2018 %o A024770 (Python) %o A024770 from sympy import primerange %o A024770 p = lambda x: list(primerange(x, x+10)); A024770 = p(0); i=0 %o A024770 while i<len(A024770): A024770+=p(A024770[i]*10); i+=1 # _M. F. Hasler_, Mar 11 2020 %Y A024770 Supersequence of A085823, A202263. Subsequence of A012883, A068669. - _Jaroslav Krizek_, Jan 28 2012 %Y A024770 Supersequence of A239747. %Y A024770 Cf. A033664, A024785 (left-truncatable primes), A032437, A020994, A052023, A052024, A052025, A050986, A050987, A069866, A077390 (left-and-right-truncatable primes), A137812 (left-or-right truncatable primes), A254751, A254753. %Y A024770 Cf. A237600 for the base-16 analog. %K A024770 nonn,base,easy,fini,full,nice,tabf %O A024770 1,1 %A A024770 _David W. Wilson_