%I #26 Oct 17 2018 02:59:31
%S 10,15,146,237,597,1603,14545,13863,16053,55805,393565,219509,153263,
%T 35981,1789339,4686907,11047438,7487726,1589662,39291566,12581421,
%U 6974465,93519854,140140538,5835191,756869018,251306317,285074689,1102062347,327023206,4282236806
%N a(n) is the smallest semiprime followed by gap (to the next semiprime) equal to n-th semiprime.
%C It appears that a(n) exists for any n.
%C a(41) = 42264532659, a(42) = 34279038379, a(45) = 58898255693, a(47) = 70265467489, and a(50) = 49167925231. - _Charles R Greathouse IV_, Dec 07 2016
%H Dana Jacobsen, <a href="/A278349/b278349.txt">Table of n, a(n) for n = 1..55</a> (first 39 terms from Charles R Greathouse IV)
%e a(1)=10 because p=10 and q=14 are two consecutive semiprimes and q-p=4 (first semiprime A001358(1)),
%e a(2)=15 because p=15 and q=21 are two consecutive semiprimes and q-p=6 (2nd semiprime A001358(2)),
%e a(3)=146 because p=146 and q=155 are two consecutive semiprimes and q-p=6=A001358(3)).
%o (PARI) issemi(n)=bigomega(n)==2
%o nextsemi(n)=while(!issemi(n), n++); n
%o listsemi(a,b)=my(v=List()); if(a<4, a=4); forprime(p=sqrtint(a-1)+1,b\2, forprime(q=(a-1)\p+1,min(b\p,p), listput(v,p*q))); Set(v)
%o list(lim)=
%o {
%o lim=nextsemi(ceil(lim));
%o my(foundsemi=[0], small=listsemi(4,max(sqrtint(lim),4)), v=small, lastsmall=small[#small], needed=4);
%o while(v[1]<lim,
%o for(i=2,#v,
%o my(g=v[i]-v[i-1], idx);
%o if(g<needed, next);
%o if(g>lastsmall,
%o small=listsemi(4,max(2*lastsmall,g));
%o lastsmall=small[#small]
%o );
%o idx=setsearch(small,g);
%o if(!idx, next);
%o if(idx>#foundsemi,
%o foundsemi=concat(foundsemi,vector(idx-#foundsemi));
%o );
%o if(foundsemi[idx]==0,
%o foundsemi[idx]=v[i-1];
%o if(needed==g,
%o for(j=idx,#foundsemi,
%o if(foundsemi[j]==0, break);
%o needed=small[j+1];
%o )
%o );
%o )
%o );
%o v=listsemi(v[#v], min(nextsemi(v[#v]+10^7), lim));
%o );
%o for(i=1,#foundsemi,
%o if(foundsemi[i]==0, return(foundsemi[1..i-1]))
%o );
%o foundsemi;
%o } \\ _Charles R Greathouse IV_, Nov 19 2016
%o (Perl) use ntheory ":all";
%o my($l,$nxti,$nxt,@G)=(4,1,4);
%o forsemiprimes {
%o if (!exists $G[$_-$l]) {
%o $G[$_-$l]=$l;
%o while (exists $G[$nxt]) {
%o print "$nxti $G[$nxt]\n";
%o $nxt=nth_semiprime(++$nxti);
%o }
%o }
%o $l=$_;
%o } 5,1e8; # _Dana Jacobsen_, Oct 16 2018
%Y Cf. A001358.
%K nonn
%O 1,1
%A _Zak Seidov_, Nov 19 2016
%E a(14) and a(19) corrected by _Charles R Greathouse IV_, Nov 19 2016
%E a(27)-a(35) from _Charles R Greathouse IV_, Nov 19 2016
%E a(36)-a(38) from _Charles R Greathouse IV_, Nov 22 2016
|