A243625 a(n) is the smallest positive integer not already in the sequence for which a(n)+a(n-1) is a semiprime, with a(1)=1.
1, 3, 6, 4, 2, 7, 8, 13, 9, 5, 10, 11, 14, 12, 21, 17, 16, 18, 15, 19, 20, 26, 23, 28, 27, 22, 24, 25, 30, 32, 33, 29, 36, 38, 31, 34, 35, 39, 43, 42, 40, 37, 45, 41, 44, 47, 46, 48, 58, 53, 62, 49, 57, 54, 52, 59, 56, 50, 61, 60, 51, 55, 63, 66, 67, 74, 68
Offset: 1
Keywords
Examples
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.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A055265.
Programs
-
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]
Comments