%I #17 Jul 09 2019 10:49:28
%S 6,34,82,226,687,4786,14367,28738,373763,21408927,158279834,
%T 2690757467,36906080234
%N Take a squarefree semiprime and take the difference between its prime factors. If this difference is a squarefree semiprime repeat the process. Sequence lists the smallest squarefree semiprime that generates other squarefree semiprimes in the first n steps of this process.
%C a(13) <= 848839845911, a(14) <= 1697679691826, a(15) <= 28860554761331, a(16) <= 57721109522666, a(17) <= 634932204749447. - _Daniel Suteu_, Jul 09 2019
%H Rémy Sigrist, <a href="/A296808/a296808.txt">C++ program for A296808</a>
%e 6 = 2*3.
%e 34 = 2*17, 17-2 = 15 = 3*5.
%e 82 = 2*41, 41-2 = 39 = 3*13, 13-3 = 10 = 2*5.
%e 226 = 2*113, 113-2 = 111 = 3*37, 37-3 = 34 = 2*17, 17-2 = 15 = 3*5.
%p with(numtheory): P:=proc(q) local a,b,j,k,n,ok,x; x:=1;for k from 1 to q do for n from x to q do ok:=1; b:=n; for j from 1 to k do if issqrfree(b) and nops(factorset(b))=2 then b:=ifactors(b)[2]; b:=b[1][1]-b[2][1]; else ok:=0; break; fi; od;if ok=1 then x:=n; print(n); break; fi; od; od; end: P(10^20);
%t test[i_] := Module[{f}, If[Length[f = FactorInteger[i]] != 2 || f[[1, 2]] + f[[2, 2]] != 2, Return[0], Return[f[[2, 1]] - f[[1, 1]]]]];
%t A296808[n_] := Module[{d}, SelectFirst[Range[10^6], If[d = test[#]; d == 0, False, AllTrue[Table[If[d = test[d]; d != 0, True, False], n], TrueQ]] &]]
%t Table[A296808[n], {n, 0, 8}] (* _Robert Price_, May 25 2019 *)
%o (C++) See Links section.
%Y Cf. A001358, A006881, A296096.
%K nonn,hard,more
%O 0,1
%A _Paolo P. Lava_, Dec 21 2017
%E a(9)-a(10) from _Rémy Sigrist_, Jan 10 2018
%E a(11)-a(12) from _Daniel Suteu_, Jul 09 2019