OFFSET
1,2
COMMENTS
EXAMPLE
For n = 3: 1110111, 1111111, 1112111 and 1113111 are all composite, while 1114111 is prime, so the smallest number that can be inserted between strings of three ones so that the concatenation is prime is 4. Therefore a(3) = 4.
MATHEMATICA
Table[Module[{k=0}, While[!PrimeQ[FromDigits[Flatten[Join[{PadRight[ {}, n, 1], IntegerDigits[ k], PadRight[{}, n, 1]}]]]], k++]; k], {n, 70}] (* Harvey P. Dale, Jun 03 2024 *)
PROG
(PARI) eva(n) = subst(Pol(n), x, 10)
a(n) = my(v=vector(n, t, 1), d, w=[]); for(k=0, oo, d=digits(k); w=concat(v, d); w=concat(w, v); if(ispseudoprime(eva(w)), return(k)))
(Python)
from sympy import isprime
def a(n, d=1):
k, bread = 0, str(d)*n
while not isprime(int(bread + str(k) + bread)): k += 1
return k
print([a(n) for n in range(1, 67)]) # Michael S. Branicky, Jun 11 2021
CROSSREFS
KEYWORD
nonn,base,less
AUTHOR
Felix Fröhlich, Jun 11 2021
STATUS
approved