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

A344936 a(n) is the smallest prime p such that a string s of n zeros can be inserted between all adjacent digits of p simultaneously such that the resulting number is also prime and is also prime for each s of length k with 0 < k < n.

Original entry on oeis.org

11, 19, 19, 71, 98689, 130049597, 78736136153
Offset: 1

Views

Author

Felix Fröhlich, Jun 03 2021

Keywords

Comments

a(n) is the smallest prime p such that A344937(i) >= n, where i is the index of p in A000040.

Examples

			For n = 5: 98689, 908060809, 9008006008009, 90008000600080009, 900008000060000800009 and 9000008000006000008000009 are all prime. Since 98689 is the smallest prime where strings of zeros of successive lengths up to 5 can be inserted between all adjacent digits such that each resulting number is also prime, a(5) = 98689.
		

Crossrefs

Programs

  • Mathematica
    Table[m=1;While[!And@@Table[PrimeQ@FromDigits@Flatten@Riffle[IntegerDigits@Prime@m,{Table[0,k]}],{k,n}],m++];Prime@m,{n,5}] (* 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) = forprime(p=10, , for(k=1, n, if(!ispseudoprime(eva(insert_zeros(p, k))), break, if(k==n, return(p)))))
    
  • Python
    from sympy import isprime, nextprime
    def insert_zeros(n, k): return int(("0"*k).join(list(str(n))))
    def ok(p, n): return all(isprime(insert_zeros(p, k)) for k in range(1, n+1))
    def a(n, startat=11):
      p = startat
      while True:
        if ok(p, n): return p
        p = nextprime(p)
    print([a(n) for n in range(1, 6)]) # Michael S. Branicky, Jun 03 2021

Extensions

a(7) from Michael S. Branicky, Jun 11 2021

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

A341899 a(n) is the smallest prime p > 10 such that when strings of n zeros are inserted between every pair of adjacent digits the result is also a prime.

Original entry on oeis.org

11, 19, 17, 13, 13, 23, 17, 17, 31, 13, 23, 41, 127, 61, 23, 13, 13, 67, 53, 89, 19, 227, 17, 29, 61, 151, 31, 37, 107, 53, 1741, 263, 167, 23, 31, 89, 61, 13, 43, 241, 53, 347, 1319, 19, 79, 419, 521, 19, 809, 677, 97, 97, 1223, 89, 13, 79, 67, 257, 17, 499
Offset: 1

Views

Author

Felix Fröhlich, Jun 04 2021

Keywords

Comments

First differs from A306920 at n = 13.
a(n) = A306920(n) if A306920(n) is < 100, i.e., is a two-digit number.

Examples

			For n = 13: Inserting 13 zeros between all adjacent digits of 127 gives 10000000000000200000000000007, which is prime. Since 127 is the smallest prime where inserting exactly 13 zeros between all adjacent digits results in a number that is also prime, a(13) = 127.
		

Crossrefs

Programs

  • 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) = forprime(p=10, , if(ispseudoprime(insert_zeros(p, n)), return(p)))

A358318 For n >= 5, a(n) is the number of zeros that need to be inserted to the left of the ones digit of the n-th prime so that the result is composite.

Original entry on oeis.org

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

Views

Author

Rida Hamadani, Nov 09 2022

Keywords

Comments

Conjecture: the sequence is bounded.

Examples

			For n = 8, prime(8) is 19. 109, 1009, and 10009 are all primes, while 100009 is not, thus a(8) = 4.
For n = 30, prime(30) is 113. 1103 and 11003 are prime, while 110003 is not, thus a(30) = 3.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{p = Prime[n], c = 1, q, r}, r = Mod[p, 10]; q = 10*(p - r); While[PrimeQ[q + r], q *= 10; c++]; c]; Array[a, 100, 5] (* Amiram Eldar, Nov 27 2022 *)
  • PARI
    a(n) = n=prime(n); for(i=1,oo, isprime(n=10*n-n%10*9) || return(i)); \\ Kevin Ryde, Dec 08 2022
  • Python
    from sympy import isprime, prime
    def a(n):
        s, c = str(prime(n)), 1
        while isprime(int(s[:-1] + '0'*c + s[-1])): c += 1
        return c
    print([a(n) for n in range(5, 92)]) # Michael S. Branicky, Nov 09 2022
    

Formula

If a(n) > 1 then a(pi(k)) = a(n) - 1 where k = 100*floor(p/10) + p mod 10 and p = prime(n) (i.e., k is the result when a single 0 is inserted to the left of the ones digit of p).
Showing 1-4 of 4 results.