This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A254043 #33 Jan 08 2025 11:05:42 %S A254043 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, %T A254043 27,29,34,24,32,36,42,35,41,30,33,31,40,46,43,39,38,48,44,47,45,50,37, %U A254043 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 %N A254043 a(n) is the smallest number not already used such that the sum of the first n terms is semiprime. %C A254043 Is this a permutation of the natural numbers? - _Derek Orr_, Feb 07 2015 %e A254043 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. %p A254043 N:= 1000: # get all terms before the first term > N %p A254043 S:= {$1..N} minus {4}: %p A254043 T:= 4: A[1]:= 4: %p A254043 for n from 2 do %p A254043 found:= false; %p A254043 for s in S do %p A254043 if numtheory:-bigomega(s+T) = 2 then %p A254043 A[n]:= s; %p A254043 S:= S minus {s}; %p A254043 T:= s + T; %p A254043 found:= true; %p A254043 break %p A254043 fi %p A254043 od: %p A254043 if not found then break fi; %p A254043 od: %p A254043 seq(A[i],i=1..n-1); # _Robert Israel_, Mar 24 2015 %t A254043 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 *) %o A254043 (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 %Y A254043 Cf. A001358, A054408, A287662. %K A254043 nonn,easy %O A254043 1,1 %A A254043 _G. L. Honaker, Jr._, Jan 23 2015