login
A254043
For n >= 1, a(n) is the smallest number not already used such that the sum of the first n terms is semiprime.
0
4, 2, 3, 1, 5, 6, 12, 13, 9, 7, 15, 8, 10, 11, 16, 19, 14, 22, 17, 20, 21, 18, 25, 23, 26, 28, 27, 29, 34, 24, 32, 36, 42, 35, 41, 30, 33, 31, 40, 46, 43, 39, 38, 48, 44, 47, 45, 50, 37, 56, 51, 49, 55, 60, 58, 63, 53, 64, 62, 52, 54, 66, 57, 69, 70, 80, 61, 68, 59, 65, 71, 72, 81, 76, 83
OFFSET
1,1
COMMENTS
Is this a permutation of the natural numbers? - Derek Orr, Feb 07 2015
EXAMPLE
a(3) = 3 because 3 is the smallest number not already used such that the sum of all 3 terms (4 + 2 + 3 = 9) is semiprime.
MAPLE
N:= 1000: # get all terms before the first term > N
S:= {$1..N} minus {4}:
T:= 4: A[1]:= 4:
for n from 2 do
found:= false;
for s in S do
if numtheory:-bigomega(s+T) = 2 then
A[n]:= s;
S:= S minus {s};
T:= s + T;
found:= true;
break
fi
od:
if not found then break fi;
od:
seq(A[i], i=1..n-1); # Robert Israel, Mar 24 2015
MATHEMATICA
f[n_] := Block[{k, s = Select[Range[2(n^2 + n)/3], PrimeOmega@ # == 2 &], t = Table[4, {n}]}, For[k = 2, k <= n, k++, t[[k]] = Min@ Select[s - Total[Take[t, k - 1]], # > 0 && ! MemberQ[t, #] &]]; t]; f@ 75 (* Michael De Vlieger, Mar 24 2015 *)
PROG
(PARI) v=[4]; n=1; while(n<100, if(bigomega(vecsum(v)+n)==2&&!vecsearch(vecsort(v), n), v=concat(v, n); n=0); n++); v \\ Derek Orr, Feb 07 2015
CROSSREFS
Cf. A001358.
Sequence in context: A145326 A178915 A222221 * A016513 A063447 A304786
KEYWORD
nonn,easy
AUTHOR
G. L. Honaker, Jr., Jan 23 2015
STATUS
approved