OFFSET
1,2
LINKS
Zak Seidov and Robert Israel, Table of n, a(n) for n = 1..1500 (first 286 terms from Zak Seidov)
MAPLE
S:= {1}: L:= {}:
a[1]:= 1: b[1]:= 1:
count:= 1:
for n from 2 to 10000 do
for k in L do
if isprime(k+b[n-1]) then
b[n]:= k;
S:= S union {k};
L:= L minus {k};
if L = {} then
count:= count+1;
a[count]:= n;
fi;
break;
fi
od:
if not assigned(b[n]) then
for k from max(S) + 1 do
if isprime(k+b[n-1]) then
b[n]:= k;
if k = max(S) + 1 and L = {} then
count:= count+1;
a[count]:= n;
fi;
S:= S union {k};
L:= {$1..k} minus S;
break
fi
od
fi;
od:
seq(a[i], i=1..count); # Robert Israel, Sep 10 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
John W. Layman, Apr 15 2003
STATUS
approved