Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #19 Jun 01 2022 01:53:21
%S 4,9,25,26,27,35,38,39,49,50,51,77,80,81,91,92,93,95,98,99,115,116,
%T 117,119,121,122,123,125,128,129,133,134,135,143,146,147,155,158,159,
%U 161,164,165,169,172,175,177,178,185,187,188,189,205,206,207,209,212,213
%N a(n) is larger than a(n-1), not prime and coprime to a(n-1) and a(n-2).
%H Harvey P. Dale, <a href="/A126638/b126638.txt">Table of n, a(n) for n = 1..1000</a>
%e a(7) = 38 because it is the next composite number larger than 35 (a(6)) that shares no factors in common with 35 and 27 (a(5)).
%p with(numtheory); i:=4; j:=9; k:=10; while(k < 100) do while(order(k, i) = FAIL or order(k,j) = FAIL or isprime(k)) do k:=k+1; end do; print(k); i:= j; j:=k; k:=k+1; end do;
%t f[l_List] := Block[{k = l[[ -1]] + 1},While[PrimeQ[k] || GCD[k, l[[ -1]]*l[[ -2]]] > 1, k++ ];Append[l, k]];Nest[f, {4, 9}, 56] (* _Ray Chandler_, Feb 14 2007 *)
%t nxt[{a_,b_}]:=Module[{k=b+1},While[PrimeQ[k]||!CoprimeQ[a,k] || !CoprimeQ[ b,k],k++];{b,k}]; NestList[nxt,{4,9},60][[All,1]] (* _Harvey P. Dale_, Aug 31 2021 *)
%Y Cf. A051884.
%K nonn
%O 1,1
%A _Ben Paul Thurston_, Feb 08 2007
%E Extended by _Ray Chandler_, Feb 14 2007