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

A068174 Define an increasing sequence as follows. Start with an initial term, the seed (which need not have the property of the sequence); subsequent terms are obtained by inserting/placing at least one digit in the previous term to obtain the smallest number with the given property. This is the prime sequence with the seed a(1) = 9.

Original entry on oeis.org

9, 19, 109, 1009, 10009, 100019, 1000159, 10001569, 100001569, 1000015069, 10000135069, 100001350649, 1000013500649, 10000130500649, 100001303500649, 1000013032500649, 10000103032500649, 100001030325003649, 1000010130325003649, 10000101303250036493
Offset: 1

Views

Author

Amarnath Murthy, Feb 25 2002

Keywords

Examples

			The primes obtained by inserting/placing a digit in a(2) = 19 are 109, 139, 149, 179, 199 etc. and a(3) = 109 is the smallest.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{b = PadLeft[ IntegerDigits[n], Floor[ Log[10, n] + 1]], k = 0}, While[ !PrimeQ[ FromDigits[ Insert[b, k, -2]]], k++ ]; FromDigits[ Insert[b, k, -2]]]; NestList[ f, 9, 18]

Extensions

Edited by N. J. A. Sloane and Robert G. Wilson v, May 08 2002
Corrected and extended by Robert Gerbicz, Sep 06 2002

A356273 a(n) is the position of the least prime in the ordered set of numbers obtained by inserting/placing any digit anywhere in the digits of n (except a zero before 1st digit), or 0 if there is no prime in that set.

Original entry on oeis.org

2, 5, 1, 5, 8, 7, 1, 11, 1, 2, 1, 10, 1, 14, 7, 10, 1, 10, 1, 0, 4, 7, 4, 7, 8, 11, 1, 11, 4, 10, 1, 0, 2, 14, 11, 16, 1, 14, 1, 5, 2, 7, 8, 11, 16, 11, 3, 19, 1, 8, 1, 8, 3, 10, 17, 14, 1, 20, 3, 7, 4, 0, 1, 11, 14, 13, 1, 17, 2, 8, 2, 16, 1, 14, 13, 14, 2, 22, 1, 17
Offset: 1

Views

Author

Michel Marcus, Aug 01 2022

Keywords

Comments

It appears that a(n) = 0 for n in A124665.
891, a term of A124665 and with a(891) = 9, is the first counterexample. - Michael S. Branicky, Aug 01 2022

Examples

			For n=1, the resulting set is (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 31, 41, 51, 61, 71, 81, 91) where the least prime 11 is at position 2, so a(1) = 2.
For n=2, the resulting set is (12, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 42, 52, 62, 72, 82, 92) where the least prime 23 is at position 5, so a(2) = 5.
		

Crossrefs

Related to the process in A068166, A068167, A068169, A068170, A068171, A068172, A068173, and A068174.
Cf. A124665.

Programs

  • Mathematica
    Table[Function[w, If[IntegerQ[#], #, 0] &@ FirstPosition[Rest@ Union@ Flatten@ Table[FromDigits@ Insert[w, d, k], {k, Length[w] + 1, 1, -1}, {d, 0, 9}], ?PrimeQ][[1]]][IntegerDigits[n]], {n, 80}] (* _Michael De Vlieger, Aug 01 2022 *)
  • PARI
    get(d, rd, n, k) = {if (n==0, return(fromdigits(concat(d, k)))); if (n==#d, return(fromdigits(concat(k, d)))); my(v = concat(Vec(d, #d-n), k)); v = concat(v, Vecrev(Vec(rd, n))); fromdigits(v);}
    a(n) = {my(d=digits(n), rd = Vecrev(d), list = List(), p); for (n=0, #d, my(kstart = if (n==#d, 1, 0)); for (k=kstart, 9, listput(list, get(d, rd, n, k)););); my(svec = Set(Vec(list))); for (k=1, #svec, if (isprime(svec[k]), return(k)););}
    
  • Python
    from sympy import isprime
    def a(n):
        s = str(n)
        out = set(s[:i]+c+s[i:] for i in range(len(s)+1) for c in "0123456789")
        out = sorted(int(k) for k in out if k[0] != "0")
        ptest = (i for i, k in enumerate(sorted(out), 1) if isprime(int(k)))
        return next(ptest, 0)
    print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Aug 01 2022
Showing 1-2 of 2 results.