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

A053582 a(n+1) is the smallest prime ending with a(n), where a(1)=1.

Original entry on oeis.org

1, 11, 211, 4211, 34211, 234211, 4234211, 154234211, 3154234211, 93154234211, 2093154234211, 42093154234211, 342093154234211, 11342093154234211, 3111342093154234211, 63111342093154234211, 2463111342093154234211, 232463111342093154234211
Offset: 1

Views

Author

G. L. Honaker, Jr., Jan 18 2000

Keywords

Examples

			The least prime ending with seed 1 is 11; the least prime ending with 11 is 211; the least prime ending with 211 is 4211. - _Clark Kimberling_, Sep 17 2015
		

Crossrefs

Programs

  • Maple
    R:= 1: v:= 1:
    for iter from 1 to 30 do
    d:= ilog10(v)+1;
    for x from v+10^d by 10^d do
      if isprime(x) then R:= R, x; v:= x; break fi
    od
    od:
    R; # Robert Israel, Sep 24 2020
  • Mathematica
    f[n_] := f[n] = Block[{j = f[n - 1], k = 1, l = Floor[Log[10, f[n - 1]] + 1]},   While[m = k*10^l + j; ! PrimeQ@ m, k++ ]; m]; f[1] = 1; Array[f, 17]
    nxt[n_]:=Module[{k=1,p=10^IntegerLength[n]},While[!PrimeQ[k*p+n],k++];k*p+n]; NestList[nxt,1,20] (* Harvey P. Dale, Jul 14 2016 *)
  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(an=1): # generator of terms
        while True:
            yield an
            pow10 = 10**len(str(an))
            for t in count(pow10+an, step=pow10):
                if isprime(t):
                    an = t
                    break
    print(list(islice(agen(), 18))) # Michael S. Branicky, Jun 23 2022

Extensions

a(14)-a(17) corrected by Robert G. Wilson v, Dec 07 2010

A053584 a(n+1) is the smallest prime ending with a(n), where a(1)=7.

Original entry on oeis.org

7, 17, 317, 6317, 26317, 126317, 2126317, 72126317, 372126317, 5372126317, 125372126317, 15125372126317, 415125372126317, 23415125372126317, 2223415125372126317, 152223415125372126317, 21152223415125372126317, 4221152223415125372126317
Offset: 1

Views

Author

G. L. Honaker, Jr., Jan 18 2000

Keywords

Crossrefs

Programs

  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(an=7):
        while True:
            yield an
            pow10 = 10**len(str(an))
            for t in count(pow10+an, step=pow10):
                if isprime(t):
                    an = t
                    break
    print(list(islice(agen(), 18))) # Michael S. Branicky, Jun 23 2022

A069612 a(1) = 19 (the smallest prime ending in a 9) and a(n+1) = smallest prime ending in a(n).

Original entry on oeis.org

19, 419, 5419, 35419, 435419, 11435419, 111435419, 9111435419, 89111435419, 1389111435419, 81389111435419, 381389111435419, 15381389111435419, 3315381389111435419, 153315381389111435419, 22153315381389111435419, 2022153315381389111435419
Offset: 1

Views

Author

Amarnath Murthy, Mar 27 2002

Keywords

Crossrefs

Programs

  • Mathematica
    w=9; Table[w; i=1; While[PrimeQ[ToExpression[StringJoin[ToString[i], ToString[w]]]]==False, i++ ]; w=ToExpression[StringJoin[ToString[i], ToString[w]]], {32}]
    nxt[n_]:=Module[{c=10^IntegerLength[n],x=1},While[!PrimeQ[c*x+n],x++];c*x+n]; NestList[nxt,19,15] (* Harvey P. Dale, Sep 25 2013 *)
  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(an=19):
        while True:
            yield an
            pow10 = 10**len(str(an))
            for t in count(pow10+an, step=pow10):
                if isprime(t):
                    an = t
                    break
    print(list(islice(agen(), 17))) # Michael S. Branicky, Jun 23 2022

Extensions

More terms from Hans Havermann, Jun 06 2002

A101115 Beginning with the n-th prime, the number of successive times a new prime can be formed by prepending the smallest nonzero digit.

Original entry on oeis.org

0, 5, 0, 9, 5, 4, 8, 4, 5, 9, 4, 6, 2, 7, 6, 8, 9, 7, 6, 3, 14, 5, 5, 2, 4, 10, 1, 5, 7, 3, 4, 3, 5, 5, 0, 6, 5, 8, 5, 13, 4, 5, 4, 5, 3, 8, 4, 4, 5, 8, 3, 6, 1, 4, 4, 2, 5, 2, 2, 3, 4, 9, 8, 7, 4, 7, 3, 3, 5, 5, 7, 8, 4, 3, 3, 2, 1, 7, 0, 4, 3, 5, 3, 7, 9, 6, 6, 5, 6, 8
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Dec 02 2004

Keywords

Comments

It is possible the procedure described would generate some left-truncatable primes (A024785). Although zero digits cannot be added, it is possible the starting prime may contain zeros. Therefore the possible number of digit additions is not limited by the length of the largest known left-truncatable prime. Further, because the smallest digit that satisfies the requirement is used each time, it is possible that choosing a larger digit would allow more single digits to be added. Therefore although some of the set of left-truncatable primes may be generated by this practice, not all of them will.
In principle it is possible that some a(n) is undefined because the process could go on indefinitely, but this is very unlikely. The largest a(n) for n <= 300000 is a(49120) = 18. - Robert Israel, Jun 29 2015

Examples

			a(2) is 5 because the second prime is 3, to which single nonzero digits can be prepended 5 times yielding a new prime each time (giving preference to the smallest digit that satisfies the requirement): 13, 113, 2113, 12113, 612113 (see A053583). There is no nonzero digit which can be prepended to 612113 to yield a new prime.
a(21) = 14 because the 21st prime (73) can be prepended with single nonzero digits 14 times yielding a new prime each time: 73, 173, 6173, 66173, ..., 4818372912366173.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p, nd, d, count, x, success;
          p:= ithprime(n); nd:= ilog10(p);
          for count from 0 do
            nd:= nd+1;
            success:= false;
            for d from 1 to 9 do
              x:= 10^nd * d + p;
              if isprime(x) then
                 success:= true;
                 break
              fi
            od;
            if not success then return(count) fi;
            p:= x;
          od
    end proc:
    map(f, [$1..100]); # Robert Israel, Jun 29 2015
  • Python
    from sympy import isprime, prime
    def a(n):
        pn = prime(n)
        s, c, found = str(pn), 0, True
        while found:
            found = False
            for d in "123456789":
                if isprime(int(d+s)):
                    s, c, found = d+s, c+1, True
                    break
        return c
    print([a(n) for n in range(1, 91)]) # Michael S. Branicky, Jun 24 2022

A077713 a(1) = 3; thereafter a(n) = the smallest prime of the form d0...0a(n-1), where d is a single digit, or 0 if no such prime exists.

Original entry on oeis.org

3, 13, 113, 2113, 12113, 612113, 50612113, 1050612113, 6001050612113, 26001050612113, 1026001050612113, 6000001026001050612113, 500006000001026001050612113, 600500006000001026001050612113, 1600500006000001026001050612113, 6001600500006000001026001050612113
Offset: 1

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

a(n) is the smallest prime obtained by prefixing a(n-1) with a number of the form d*10^k where d is a single digit, 0 < d < 10, and k >= 0. Conjecture: d*10^k always exists.

Examples

			a(7) = 50612113: deleting 5 gives 612113 = a(6).
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local k, m, d, p;
          if n=1 then 3 else k:= a(n-1);
            for m from length(k) do
              for d to 9 do p:= k +d*10^m;
                if isprime(p) then return p fi
            od od
          fi
        end:
    seq(a(n), n=1..20);  # Alois P. Heinz, Jan 12 2015
  • Python
    from sympy import isprime
    from itertools import islice
    def agen(an=3):
        while True:
            yield an
            pow10 = 10**len(str(an))
            while True:
                found = False
                for t in range(pow10+an, 10*pow10+an, pow10):
                    if isprime(t):
                        an = t; found = True; break
                if found: break
                pow10 *= 10
    print(list(islice(agen(), 16))) # Michael S. Branicky, Jun 23 2022

Extensions

More terms from Ray Chandler, Jul 23 2003
Changed offset to 1 by Alois P. Heinz, Jan 12 2015
Definition clarified by N. J. A. Sloane, Jan 19 2015

A101116 Values in A101115 which are records.

Original entry on oeis.org

0, 5, 9, 14, 15, 18, 19, 20, 22
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Dec 02 2004

Keywords

Comments

All primes up to 1000003 have been tested.

Crossrefs

Programs

  • Python
    from sympy import isprime, nextprime
    def agen(): # generator of tuple of terms of (A101116, A101117, A101118)
        n, pn, record = 0, 1, -1
        while True:
            n += 1
            pn = nextprime(pn)
            s, c, found = str(pn), 0, True
            while found:
                found = False
                for d in "123456789":
                    if isprime(int(d+s)):
                        s, c, found = d+s, c+1, True
                        break
            if c > record:
                record = c
                yield record, pn, int(s)
    g = agen()
    print([next(g)[0] for n in range(1, 7)]) # Michael S. Branicky, Jun 24 2022

Extensions

a(7)-a(8) from Michael S. Branicky, Jun 24 2022
a(9) from Michael S. Branicky, Jul 26 2024

A101118 a(n) = the resulting prime generated when the process described in A101115 is applied to A101117(n).

Original entry on oeis.org

2, 612113, 5372126317, 4818372912366173, 21291981879276213799, 912733515196363393600307, 668334992181698187977197951, 231879245133561335194866134641, 933651219687395363156136052921903
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Dec 02 2004

Keywords

Examples

			a(3) = 5372126317 because 5372126317 is the last prime that can be generated by successively prepending nonzero digits to A101117(3). A101117(3) is 7. A101116(3) indicates that 9 digits can be successively prepended to 7 generating a new prime each time. Doing so and giving preference to the smallest digit which meets the requirement, generates the following primes: 17, 317, 6317, 26317, 126317, 2126317, 72126317, 372126317, 5372126317.
		

Crossrefs

Programs

  • Python
    g = agen() # uses agen() and imports from A101116
    print([next(g)[2] for n in range(1, 7)]) # Michael S. Branicky, Jun 24 2022

Extensions

a(7)-a(8) and typo corrected in a(6) from Michael S. Branicky, Jun 24 2022
a(9) from Michael S. Branicky, Jul 26 2024

A101117 a(n) = the first prime yielding the record value A101116(n).

Original entry on oeis.org

2, 3, 7, 73, 13799, 600307, 77197951, 4866134641, 36052921903
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Dec 02 2004

Keywords

Examples

			a(6) = 600307 because 600307 is the first prime to which A101116(6) digits (18) can be prepended yielding a new prime each time (giving preference to the smallest digit which meets the requirement) - 600307, 3600307, 93600307, ..., 9912733515196363393600307.
		

Crossrefs

Programs

  • Python
    g = agen() # uses agen() and imports from A101116
    print([next(g)[1] for n in range(1, 7)]) # Michael S. Branicky, Jun 24 2022

Extensions

a(7)-a(8) from Michael S. Branicky, Jun 24 2022
a(9) from Michael S. Branicky, Jul 26 2024

A360225 a(1) = 2, a(2) = 3, a(n) = the smallest prime whose digits consist of a(n-2), followed by zero or more digits, followed by a(n).

Original entry on oeis.org

2, 3, 23, 3023, 2393023, 3023172393023, 2393023313023172393023, 3023172393023282393023313023172393023, 239302331302317239302383023172393023282393023313023172393023
Offset: 1

Views

Author

Robert C. Lyons, Jan 30 2023

Keywords

Examples

			a(4) = 3023 because int(concat('3', '23')) is not prime, and int(concat('3', '0', '23')) is prime.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    max_n = 10
    prev_prev = 2
    prev = 3
    seq = [prev_prev, prev]
    for n in range(3, max_n+1):
        result = int(str(prev_prev) + str(prev))
        if not isprime(result):
            middle_length = 1
            keep_searching = True
            while keep_searching:
                for middle in range(0, 10**middle_length):
                    result = int(str(prev_prev) + str(middle).zfill(middle_length) + str(prev))
                    if isprime(result):
                        keep_searching = False
                        break
                middle_length = middle_length + 1
        seq.append(result)
        prev_prev = prev
        prev = result
    print(seq)
Showing 1-9 of 9 results.