cp's OEIS Frontend

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.

Showing 1-3 of 3 results.

A024770 Right-truncatable primes: every prefix is prime.

Original entry on oeis.org

2, 3, 5, 7, 23, 29, 31, 37, 53, 59, 71, 73, 79, 233, 239, 293, 311, 313, 317, 373, 379, 593, 599, 719, 733, 739, 797, 2333, 2339, 2393, 2399, 2939, 3119, 3137, 3733, 3739, 3793, 3797, 5939, 7193, 7331, 7333, 7393, 23333, 23339, 23399, 23993, 29399, 31193
Offset: 1

Views

Author

Keywords

Comments

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).
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
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

References

  • Roozbeh Hazrat, Mathematica: A Problem-Centered Approach, Springer London 2010, pp. 86-89.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 112-113.

Crossrefs

Supersequence of A085823, A202263. Subsequence of A012883, A068669. - Jaroslav Krizek, Jan 28 2012
Supersequence of A239747.
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.
Cf. A237600 for the base-16 analog.

Programs

  • Haskell
    import Data.List (inits)
    a024770 n = a024770_list !! (n-1)
    a024770_list = filter (\x ->
       all (== 1) $ map (a010051 . read) $ tail $ inits $ show x) a038618_list
    -- Reinhard Zumkeller, Nov 01 2011
    
  • Maple
    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
  • Mathematica
    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 *)
    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 *)
  • 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
    
  • 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
    
  • 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
    
  • Python
    from sympy import primerange
    p = lambda x: list(primerange(x, x+10)); A024770 = p(0); i=0
    while iA024770): A024770+=p(A024770[i]*10); i+=1 # M. F. Hasler, Mar 11 2020

A119289 Prime numbers p such that there is no prime between 10*p and 10*p+9 inclusive.

Original entry on oeis.org

53, 89, 107, 113, 167, 179, 251, 317, 347, 389, 397, 419, 431, 443, 457, 461, 521, 599, 641, 643, 653, 709, 727, 761, 773, 797, 839, 863, 887, 907, 911, 977, 991, 1087, 1091, 1103, 1153, 1187, 1213, 1217, 1229, 1231, 1259, 1277, 1283, 1301, 1307, 1319, 1327
Offset: 1

Views

Author

Tanya Khovanova, Jul 23 2006

Keywords

Comments

Prime numbers p with property that appending any single decimal digit to p does not produce a prime. Prime members of A032352.

Crossrefs

Supersequence of A239747.

Programs

  • Maple
    a:=proc(n) if isprime(n) = true and isprime(10*n+1)=false and isprime(10*n+3)=false and isprime(10*n+5)=false and isprime(10*n+7)=false and isprime(10*n+9)=false then n else fi end: seq(a(n),n=1..1500); # Emeric Deutsch, Jul 24 2006
  • Mathematica
    Select[Prime[Range[1000]], PrimePi[10# + 9] - PrimePi[10# ] == 0 &] (* Stefan Steinerberger, Jul 24 2006 *)
  • PARI
    lista(nn) = {forprime(p=2, nn, if (primepi(10*p+9) - primepi(10*p) == 0, print1(p, ", ")););} \\ Michel Marcus, Jun 23 2015
    
  • Python
    from sympy import isprime, primerange
    def ok(p): s = str(p); return all(not isprime(int(s+d)) for d in "1379")
    print(list(filter(ok, primerange(1, 1328)))) # Michael S. Branicky, Aug 08 2021

Extensions

More terms sent by several contributors, Jul 23 2006

A232125 Smallest prime such that the n numbers obtained by removing 1 digit on the right are also prime, while no digit can be added on the right to get another prime.

Original entry on oeis.org

53, 53, 317, 2393, 23333, 373393, 2399333, 23399339, 1979339333, 103997939939, 4099339193933, 145701173999399393, 2744903797739993993333, 52327811119399399313393, 13302806296379339933399333
Offset: 0

Views

Author

Michel Marcus, Nov 19 2013

Keywords

Comments

Inspired by article on 43 in Archimedes' Lab link.

Examples

			a(0)=53 because 53 is the smallest prime such that all numbers obtained by adding a digit to the right are composite.
a(1)=53 because 5 and 53 are primes.
a(2)=317 because 3, 31, 317 are all primes, and 317 has the same property as 53 when adding a digit to the right.
		

Crossrefs

Programs

  • PARI
    a(n) = {n++; v = vector(n); i = 1; ok = 0; until (ok, while ((i>1) && (v[i] == 9), v[i] = 0; i--); if (i == 1, v[i] = nextprime(v[i]+1), v[i] = v[i]+1); curp = sum (j=1, i, v[j]*(10^(i-j))); if (isprime(curp), if (i != n, i++, nbp = 0; for (z=1, 9, if (isprime(10*curp+z), nbp++);); if (nbp == 0, ok = 1);););); sum (j=1, n, v[j]*(10^(n-j)));}
    
  • Python
    from sympy import isprime, nextprime
    def a(n):
        p, oo = 2, float('inf')
        while True:
            extends, reach, r1 = 0, [str(p)], []
            while len(reach) > 0 and extends <= n:
                minnotext = oo
                for s in reach:
                    wasextended = False
                    for d in "1379":
                        if isprime(int(s+d)): r1.append(s+d); wasextended = True
                    if not wasextended: minnotext = min(minnotext, int(s))
                if extends == n and minnotext < oo: return minnotext
                if len(r1) > 0: extends += 1
                reach, r1 = r1, []
            p = nextprime(p)
    for n in range(12): print(a(n), end=", ") # Michael S. Branicky, Aug 08 2021

Extensions

a(12)-a(13) from Michael S. Branicky, Aug 08 2021
a(14) from Michael S. Branicky, Aug 23 2021
Showing 1-3 of 3 results.