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.

A290175 Smallest prime p such that A290174(i) = n, where i is the index of p in A000040.

Original entry on oeis.org

2, 11, 41, 19, 71, 367, 587, 131, 1151, 1987, 4253, 8831, 11839, 117497, 12269, 28279, 297793, 167711, 1748653, 1427297, 7655719, 13992553, 4594229, 12932441, 54321763, 32833217, 112155839, 231132271, 211119257, 1154494127, 137764883
Offset: 0

Views

Author

Felix Fröhlich, Jul 24 2017

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = Prime@ n, k = 0, w}, w = {p}; While[w != {}, w = Flatten@ Map[Block[{m = #, L = {}, q = 10, a, b, v}, While[q <= m, a = Floor[m/q]; b = Mod[m, q]; v = 10 q a + b; If[b >= q/10 && PrimeQ[v], AppendTo[L, v]]; q *= 10]; L] &, w]; k++]; k - 1]; With[{s = Array[f, 10^5]}, Map[If[# == 0, 0, Prime@ #] &@ First[FirstPosition[s, #] /. k_ /; MissingQ@ k -> {0}] &, Range[0, Max@ s]]] (* Michael De Vlieger, Jul 24 2017, after Giovanni Resta at A290174 *)
  • PARI
    insertzero(num, pos) = 10*(num-num%10^pos)+(num%10^pos)
    zeroprimevec_num(n) = my(w=[]); for(k=1, #Str(n)-1, my(x=insertzero(n, k)); if(ispseudoprime(x), w=concat(w, [x]))); vecsort(w, , 8)
    zeroprimevec_vec(v) = my(w=[]); for(k=1, #v, w=concat(w, zeroprimevec_num(v[k]))); vecsort(w, , 8)
    a290174(n) = my(i=0, p=prime(n), v=zeroprimevec_num(p)); while(1, if(#v==0, return(i), i++); v=zeroprimevec_vec(v))
    a(n) = my(x=1); while(1, if(a290174(x)==n, return(prime(x)), x++))
    
  • PARI
    first(n) = {n--; my(v = vector(n), todo = n, x=1); while(todo>0,
    r = a290174(x); if(0David A. Corneth, Jul 24 2017

Extensions

a(20)-a(30) from Giovanni Resta, Jul 24 2017

A306920 a(n) is the smallest prime > 10 where a string of exactly n zeros can be inserted somewhere into the decimal expansion such that the resulting number is also prime.

Original entry on oeis.org

11, 19, 17, 13, 13, 23, 17, 17, 31, 13, 23, 41, 137, 61, 23, 13, 13, 67, 53, 89, 19, 107, 17, 29, 61, 263, 31, 37, 127, 53, 269, 199, 137, 23, 31, 89, 61, 13, 43, 163, 53, 131, 109, 19, 79, 283, 109, 19, 269, 223, 97, 97, 223, 89, 13, 79, 67, 107, 17, 389, 197
Offset: 1

Views

Author

Felix Fröhlich, Mar 16 2019

Keywords

Comments

For many small n, if the decimal expansion of a(n) contains the digit 0, then a(n+1) is a(n) with one zero digit removed. However, this is not true in general. The counterexamples' indices in this sequence are given by A344860.

Examples

			For n = 13: If a string of 13 zeros is inserted between the digits 1 and 3 in 137, the resulting number is 1000000000000037, which is prime. Since 137 is the smallest prime where such a string of 13 zeros can be inserted to get another prime, a(13) = 137.
		

Crossrefs

Programs

  • PARI
    insert(n, len, pos) = my(d=digits(n), v=[], w=[]); for(y=1, pos, v=concat(v, d[y])); v=concat(v, vector(len)); for(z=pos+1, #d, v=concat(v, d[z])); subst(Pol(v), x, 10)
    a(n) = forprime(p=10, , for(k=1, #digits(p)-1, my(zins=insert(p, n, k)); if(ispseudoprime(zins), return(p))))

A344937 a(n) is the largest k such that when strings of zeros of lengths t = 1..k are inserted between every pair of adjacent digits of prime(n), the resulting numbers are all primes.

Original entry on oeis.org

1, 1, 1, 3, 0, 0, 0, 1, 2, 0, 0, 2, 2, 1, 2, 4, 0, 1, 0, 2, 4, 0, 0, 1, 1, 2, 0, 3, 0, 0, 0, 1, 0, 0, 2, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0
Offset: 5

Views

Author

Felix Fröhlich, Jun 03 2021

Keywords

Comments

Initially, except for n = 1..4, similar to A290174, but the two sequences differ from n = 28 onwards.

Examples

			For n = 8: prime(8) = 19 and the numbers 109, 1009 and 10009 are all prime, while 100009 is not. Thus it is possible to insert strings of zeros of lengths 1, 2 and 3 between all adjacent digits of 19 such that the resulting number is prime. Since 3 is the largest length of such a string in case of 19, a(8) = 3.
		

Crossrefs

Programs

  • Mathematica
    Table[k=0;While[PrimeQ@FromDigits@Flatten@Riffle[IntegerDigits@Prime@n,{Table[0,k]}],k++];k-1,{n,5,100}] (* Giorgos Kalogeropoulos, Jun 03 2021 *)
  • PARI
    eva(n) = subst(Pol(n), x, 10)
    insert_zeros(num, len) = my(d=digits(num), v=[]); for(k=1, #d-1, v=concat(v, concat([d[k]], vector(len)))); v=concat(v, d[#d]); eva(v)
    a(n) = my(p=prime(n), ip=p); for(k=1, oo, ip=insert_zeros(p, k); if(!ispseudoprime(ip), return(k-1)))
    
  • Python
    from sympy import isprime, prime
    def insert_zeros(n, k): return int(("0"*k).join(list(str(n))))
    def a(n):
      pn, k = prime(n), 1
      while isprime(insert_zeros(pn, k)): k += 1
      return k - 1
    print([a(n) for n in range(5, 92)]) # Michael S. Branicky, Jun 03 2021
Showing 1-3 of 3 results.