OFFSET
1,2
COMMENTS
It is probable that every positive integer occurs, and that this is a permutation of natural numbers.
a(n) = n for n = 1, 4, 9, 18, 23, 48, 54, 60, 63, 77, 91, 92, .... (375 cases for first 3000 terms). - Zak Seidov, Feb 22 2017
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3)=6 because 1 and 3 have already been used in the sequence and 3+2=5, 3+4=7 and 3+5=8 are not semiprime while 3+6=9 is semiprime.
MAPLE
N:= 1000; # to get all terms up to a(N)
issp:= proc(n) local F; F:= ifactors(n)[2]; add(f[2], f=F)=2 end proc:
S:= {1}; m:= 1; R:= {}; a[1]:= 1;
for n from 2 to N do
found:= false;
for k in R do
if issp(a[n-1]+k) then
a[n]:= k;
S:= S union {k};
R:= R minus {k};
found:= true;
break
fi;
od;
if not found then
for k from m+1 do
if issp(a[n-1]+k) then
a[n]:= k;
S:= S union {k};
R:= R union {$(m+1)..(k-1)};
m:= k;
break
fi
od
fi
od:
seq(a(n), n=1..N); # Robert Israel, Jun 08 2014
MATHEMATICA
f[s_List] := Block[{k = 1, a = s[[ -1]]}, While[ MemberQ[s, k] || ! Plus@@Last/@FactorInteger[a+k] == 2, k++ ]; Append[s, k]]; Nest[f, {1}, 71]
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jun 08 2014
STATUS
approved