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.

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.

Original entry on oeis.org

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

Views

Author

Michel Lagneau, Jun 08 2014

Keywords

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

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.
		

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]