OFFSET
1,1
COMMENTS
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
Felix Fröhlich, Jun 03 2021
EXTENSIONS
a(7) from Michael S. Branicky, Jun 11 2021
STATUS
approved