OFFSET
1,1
EXAMPLE
PROG
(PARI) is(n)=my(N=10*n, D=10^#Str(n)); forstep(k=n, n+9*D, D, if(isprime(k), return(0))); !(isprime(N+1)||isprime(N+3)||isprime(N+7)||isprime(N+9)); \\ A124665
isok(k, n) = if (!is(k-1), for (i=0, n-1, if (!is(k+i), return (0)); ); !is(k+n); );
a(n) = my(k=2); while (!isok(k, n), k++); k;
(Python)
from itertools import islice
from sympy import isprime
def ok(n):
s = str(n)
if any(isprime(int(s+c)) for c in "1379"): return False
return not any(isprime(int(c+s)) for c in "0123456789")
def agen():
adict = dict()
n = k = 1
while True:
c = 0
while ok(k): k += 1; c += 1
if c not in adict: adict[c] = k-c
while n in adict: yield adict[n]; n += 1
k += 1
print(list(islice(agen(), 6))) # Michael S. Branicky, Aug 01 2022
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Michel Marcus, Aug 01 2022
EXTENSIONS
a(14)-a(20) from Michael S. Branicky, Aug 02 2022
STATUS
approved