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-6 of 6 results.

A276132 Terms of A077390 with reverse in A077390.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 131, 151, 157, 179, 337, 353, 359, 373, 727, 733, 739, 751, 757, 929, 937, 953, 971, 1733, 1979, 3319, 3371, 3373, 3719, 3733, 7177, 7717, 9133, 9173, 9791
Offset: 1

Views

Author

Rick L. Shepherd, Aug 21 2016

Keywords

Comments

A subsequence of the reversible primes (A007500).
Inspired by Aug. 2016 SeqFan discussion about arrays of primes.
Questions: 1) What is the largest N X N square of decimal digits whose rows, columns and main diagonals are (non-palindromic) terms of this sequence?
The digits of each remaining smaller square formed by removing the outermost layer of digits of a given such square also form terms of this sequence. 2) What is the maximum number of distinct terms of this sequence that can appear in the rows, columns and diagonals of a single N X N square and of all its nested (N-2) X (N-2), (N-4) X (N-4), ..., 2 X 2 or 1 X 1 squares?
3) What is the maximum number of such consecutively nested squares comprised in total of only distinct primes?

Examples

			9791 is a term because 9791, 79, 1979 and 97 are all prime numbers.
		

Crossrefs

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

A024785 Left-truncatable primes: every suffix is prime and no digits are zero.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 23, 37, 43, 47, 53, 67, 73, 83, 97, 113, 137, 167, 173, 197, 223, 283, 313, 317, 337, 347, 353, 367, 373, 383, 397, 443, 467, 523, 547, 613, 617, 643, 647, 653, 673, 683, 743, 773, 797, 823, 853, 883, 937, 947, 953, 967, 983, 997, 1223
Offset: 1

Views

Author

Keywords

Comments

Last term is a(4260) = 357686312646216567629137 (Angell and Godwin). - Eric W. Weisstein, Dec 11 1999
Can be seen as table whose rows list n-digit terms, 1 <= n <= 25. Row lengths are A050987. - M. F. Hasler, Nov 07 2018

References

  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 113.

Crossrefs

Supersequence of A240768.
Cf. A033664, A032437, A020994, A024770 (right-truncatable primes), A052023, A052024, A052025, A050986, A050987, A077390 (left-and-right truncatable primes), A137812 (left-or-right truncatable primes), A254753.

Programs

  • Haskell
    import Data.List (tails)
    a024785 n = a024785_list !! (n-1)
    a024785_list = filter (\x ->
       all (== 1) $ map (a010051 . read) $ init $ tails $ show x) a038618_list
    -- Reinhard Zumkeller, Nov 01 2011
    
  • Maple
    a:=[[2],[3],[5],[7]]: l1:=1: l2:=4: for n from 1 to 3 do for k from 1 to 9 do for j from l1 to l2 do d:=[op(a[j]),k]: 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
    # second Maple program:
    T:= proc(n) option remember; `if`(n=0, "", sort(select(isprime,
          map(x-> seq(parse(cat(j, x)), j=1..9), [T(n-1)])))[])
        end:
    seq(T(n), n=1..4);  # Alois P. Heinz, Sep 01 2021
  • Mathematica
    max = 2000; truncate[p_] := If[id = IntegerDigits[p]; FreeQ[id, 0] && (Last[id] == 3 || Last[id] == 7) && PrimeQ[q = FromDigits[ Rest[id]]], q, p]; ok[n_] := FixedPoint[ truncate, n] < 10;p = 5; A024785 = {2, 3, 5}; While[(p = NextPrime[p]) < max, If[ok[p], AppendTo[A024785, p]]]; A024785 (* Jean-François Alcover, Nov 09 2011 *)
    d[n_]:=IntegerDigits[n]; ltrQ[n_]:=And@@PrimeQ[NestList[FromDigits[Drop[d[#],1]]&,n,Length[d[n]]-1]]; Select[Range[1225],ltrQ[#]&] (* Jayanta Basu, May 29 2013 *)
    FullList=Sort[Flatten[Table[FixedPointList[Select[Flatten[Table[Range[9]*10^Length@IntegerDigits[#[[1]]] + #[[i]], {i, Length[#]}]], PrimeQ] &, {i}], {i, {2, 3, 5, 7}}]]] (* Fabrice Laussy, Nov 10 2019 *)
  • PARI
    v=vector(4260);v[1]=2;v[2]=3;v[3]=5;v[4]=7;i=0;j=4; until(i>=j,i++;p=v[i];P10=10^(1+log(p)\log(10)); for(k=1,9,z=k*P10+p;if(isprime(z),j++;v[j]=z;))); s=vector(4260);s=vecsort(v);for(i=1,j,write("b024785.txt",i," ",s[i]);); \\
    
  • PARI
    is_A024785(n,t=1)={until(t>10*p,isprime(p=n%t*=10)||return);n==p} \\ M. F. Hasler, Apr 17 2014
    
  • PARI
    A024785=vector(25,n,p=vecsort(concat(apply(p->select(isprime, vector(9,i, i*10^(n-1)+p)),if(n>1,p))))); \\ Yields the list of rows (n-digit terms, n = 1..25). Use concat(%) to flatten. There are faster variants using matrices (vectorv(9,i,1)*p+[1..9]~*10^(n-1)*vector(#p,i,1)) and/or predefined vectors, but they are less concise and this takes less than 0.1 sec. - M. F. Hasler, Nov 07 2018
    
  • Python
    from sympy import isprime
    def alst():
      primes, alst = [2, 3, 5, 7], []
      while len(primes) > 0:
        alst += sorted(primes)
        candidates = set(int(d+str(p)) for p in primes for d in "123456789")
        primes = [c for c in candidates if isprime(c)]
      return alst
    print(alst()) # Michael S. Branicky, Apr 11 2021

A137812 Left- or right-truncatable primes.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 23, 29, 31, 37, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 113, 131, 137, 139, 167, 173, 179, 197, 223, 229, 233, 239, 271, 283, 293, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 397, 431, 433, 439, 443, 467, 479, 523, 547, 571
Offset: 1

Views

Author

T. D. Noe, Feb 11 2008

Keywords

Comments

Repeatedly removing a digit from either the left or right produces only primes. There are 149677 terms in this sequence, ending with 8939662423123592347173339993799.
The number of n-digit terms is A298048(n). - Jon E. Schoenfield, Jan 28 2022

Examples

			139 is here because (removing 9 from the right) 13 is prime and (removing 1 from the left) 3 is prime.
		

Crossrefs

Cf. A024770 (right-truncatable primes), A024785 (left-truncatable primes), A077390 (left-and-right truncatable primes), A080608.
Cf. A298048 (number of n-digit terms).

Programs

  • Mathematica
    Clear[s]; s[0]={2,3,5,7}; n=1; While[s[n]={}; Do[k=s[n-1][[i]]; Do[p=j*10^n+k; If[PrimeQ[p], AppendTo[s[n],p]], {j,9}]; Do[p=10*k+j; If[PrimeQ[p], AppendTo[s[n],p]], {j,9}], {i,Length[s[n-1]]}]; s[n]=Union[s[n]]; Length[s[n]]>0, n++ ];t=s[0]; Do[t=Join[t,s[i]], {i,n}]; t
  • Python
    from sympy import isprime
    def agen():
        primes = [2, 3, 5, 7]
        while len(primes) > 0:
            yield from primes
            cands = set(int(d+str(p)) for p in primes for d in "123456789")
            cands |= set(int(str(p)+d) for p in primes for d in "1379")
            primes = sorted(c for c in cands if isprime(c))
    afull = [an for an in agen()]
    print(afull[:60]) # Michael S. Branicky, Aug 04 2022

A077391 Smallest n-digit prime which leaves a prime at every step if most significant digit and least significant digit are deleted until a one digit or two digit prime is obtained, or 0 if no such prime exists.

Original entry on oeis.org

2, 11, 127, 1021, 10313, 100237, 1002931, 10002331, 100023331, 1000023337, 10000239937, 100000233397, 1000002339937, 10000002339931, 100000139991331, 1000000023399331, 10000000233993397, 100000000293999997
Offset: 1

Views

Author

Amarnath Murthy, Nov 07 2002

Keywords

Comments

Conjecture: No term is zero.

Examples

			a(6) = 100237: this is the smallest 6-digit number such that deleting MSD and LSD yields prime at every step, i.e. 100237, 0023, 02 all are primes.
		

Crossrefs

Cf. A077390.

Extensions

More terms from Daniel Starodubtsev, May 05 2020

A284060 Primes that are left-, left/right-, and right-truncatable.

Original entry on oeis.org

2, 3, 5, 7, 23, 37, 53, 73, 373, 3137, 3797
Offset: 1

Views

Author

Rick L. Shepherd, Mar 19 2017

Keywords

Comments

Intersection of A020994 and A077390. Only the last three terms exhibit all three properties nontrivially.

Examples

			The prime 3797 is a term because it is a term of A024785 (truncating from the left: 797, 97, 7 are primes), of A077390 (truncating the same number of digits from left and from right: 79 is a prime), and of A024770 (truncating from the right: 379, 37, 3 are primes). The digit 9 is not a prime, so 3797 is not also a term of A085823.
		

Crossrefs

Cf. A020994, A024770, A024785, A077390, A085823 (a subsequence).
Showing 1-6 of 6 results.