cp's OEIS Frontend

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.

Showing 1-1 of 1 results.

A254043 a(n) is the smallest number not already used such that the sum of the first n terms is semiprime.

Original entry on oeis.org

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

Views

Author

G. L. Honaker, Jr., Jan 23 2015

Keywords

Comments

Is this a permutation of the natural numbers? - Derek Orr, Feb 07 2015

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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
Showing 1-1 of 1 results.