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.

This page as a plain text file.
%I A243625 #21 Feb 23 2017 23:20:02
%S A243625 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,
%T A243625 24,25,30,32,33,29,36,38,31,34,35,39,43,42,40,37,45,41,44,47,46,48,58,
%U A243625 53,62,49,57,54,52,59,56,50,61,60,51,55,63,66,67,74,68
%N 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.
%C A243625 It is probable that every positive integer occurs, and that this is a permutation of natural numbers.
%C A243625 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
%H A243625 Robert Israel, <a href="/A243625/b243625.txt">Table of n, a(n) for n = 1..10000</a>
%e A243625 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.
%p A243625 N:= 1000; # to get all terms up to a(N)
%p A243625 issp:= proc(n) local F; F:= ifactors(n)[2]; add(f[2],f=F)=2 end proc:
%p A243625 S:= {1}; m:= 1; R:= {}; a[1]:= 1;
%p A243625 for n from 2 to N do
%p A243625   found:= false;
%p A243625   for k in R do
%p A243625     if issp(a[n-1]+k) then
%p A243625       a[n]:= k;
%p A243625       S:= S union {k};
%p A243625       R:= R minus {k};
%p A243625       found:= true;
%p A243625       break
%p A243625     fi;
%p A243625   od;
%p A243625   if not found then
%p A243625     for k from m+1 do
%p A243625       if issp(a[n-1]+k) then
%p A243625         a[n]:= k;
%p A243625         S:= S union {k};
%p A243625         R:= R union {$(m+1)..(k-1)};
%p A243625         m:= k;
%p A243625         break
%p A243625       fi
%p A243625     od
%p A243625   fi
%p A243625 od:
%p A243625 seq(a(n),n=1..N); # _Robert Israel_, Jun 08 2014
%t A243625 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]
%Y A243625 Cf. A055265.
%K A243625 nonn
%O A243625 1,2
%A A243625 _Michel Lagneau_, Jun 08 2014