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.
%I A116946 #17 Jun 04 2021 09:47:28 %S A116946 6,4,10,9,15,14,22,21,26,25,34,33,34,39,38,49,51,49,57,58,57,65,62,65, %T A116946 77,74,85,86,85,86,93,94,93,94,111,115,118,119,118,122,121,122,133, %U A116946 134,133,142,141,142,146,145,158,159,158,159,169,166,178,177,185 %N A116946 Closest semiprime to n-th semiprime S that is different from S (break ties by taking the smaller semiprime). %H A116946 Michael S. Branicky, <a href="/A116946/b116946.txt">Table of n, a(n) for n = 1..10000</a> %e A116946 Closest semiprimes to 4, 6, 9, 10, 14, 15, 21 are 6, 4, 10, 9, 15, 14, 22. %t A116946 csp[{a_,b_,c_}]:=If[c-b<b-a,c,a]; Join[{6},csp/@Partition[Select[Range[ 300], PrimeOmega[#]==2&],3,1]] (* _Harvey P. Dale_, May 06 2014 *) %o A116946 (Python) %o A116946 from sympy import factorint %o A116946 def semiprime(n): return sum(e for e in factorint(n).values()) == 2 %o A116946 def nextsemiprime(n): %o A116946 nxt = n + 1 %o A116946 while not semiprime(nxt): nxt += 1 %o A116946 return nxt %o A116946 def aupton(terms): %o A116946 prv, cur, nxt, alst = 0, 4, 6, [] %o A116946 while len(alst) < terms: %o A116946 alst.append(prv if 2*cur - prv <= nxt else nxt) %o A116946 prv, cur, nxt = cur, nxt, nextsemiprime(nxt) %o A116946 return alst %o A116946 print(aupton(59)) # _Michael S. Branicky_, Jun 04 2021 %Y A116946 Cf. A001358 (semiprimes), A051701 (analog for primes). %K A116946 easy,nonn %O A116946 1,1 %A A116946 _Jonathan Vos Post_, Mar 25 2006 %E A116946 Corrected by _Harvey P. Dale_, May 06 2014