login
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.
2

%I #21 Jun 11 2021 09:29:31

%S 11,19,19,71,98689,130049597,78736136153

%N 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.

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

%e 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.

%t 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 *)

%o (PARI) eva(n) = subst(Pol(n), x, 10)

%o 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)

%o a(n) = forprime(p=10, , for(k=1, n, if(!ispseudoprime(eva(insert_zeros(p, k))), break, if(k==n, return(p)))))

%o (Python)

%o from sympy import isprime, nextprime

%o def insert_zeros(n, k): return int(("0"*k).join(list(str(n))))

%o def ok(p, n): return all(isprime(insert_zeros(p, k)) for k in range(1, n+1))

%o def a(n, startat=11):

%o p = startat

%o while True:

%o if ok(p, n): return p

%o p = nextprime(p)

%o print([a(n) for n in range(1, 6)]) # _Michael S. Branicky_, Jun 03 2021

%Y Cf. A000040, A344637, A344937.

%K nonn,base,hard,more

%O 1,1

%A _Felix Fröhlich_, Jun 03 2021

%E a(7) from _Michael S. Branicky_, Jun 11 2021