OFFSET
0,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..207
EXAMPLE
a(1) = 31 because 2*31+1=63 and 2*31+3=65 are not prime.
MAPLE
nn:=10^8:
for n from 1 to 50 do:
ii:=0:
for k from 2 to nn while(ii=0)do:
p:=ithprime(k):jj:=0:
for i from 1 by 2 to 2*n-1 do:
if isprime(2*p+i)
then
jj:=1:
else
fi:
od:
if jj=0
then
ii:=1: printf(`%d, `, p):
else
fi:
od:
od:
PROG
(PARI) isok(p, n) = {forstep(k=1, 2*n+1, 2, if (isprime(2*p+k), return (0)); ); return(1); }
a(n) = {my(p=2); while(!isok(p, n), p = nextprime(p+1)); p; } \\ Michel Marcus, Sep 21 2020
(Python)
from sympy import isprime, nextprime
def a(n, startp=2):
p = startp
while any(isprime(2*p+i) for i in range(1, 2*n+2, 2)): p = nextprime(p)
return p
print([a(n) for n in range(41)]) # Michael S. Branicky, Jul 31 2021
(Python) # uses above to produce initial segment faster
def aupton(nn):
an, alst = 2, []
for n in range(nn+1): an = a(n, startp=an); alst.append(an)
return alst
print(aupton(40)) # Michael S. Branicky, Jul 31 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Sep 21 2020
STATUS
approved