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.

A135257 Smallest semiprimes such that a(j) - a(k) are all different.

This page as a plain text file.
%I A135257 #11 Sep 12 2023 02:05:11
%S A135257 4,6,9,10,21,34,55,65,74,94,141,177,203,219,298,321,395,403,529,581,
%T A135257 635,662,731,934,982,1073,1145,1317,1418,1762,1769,1849,1915,2066,
%U A135257 2165,2305,2327,2746,2809,3127,3409,3859,3983,4138,4285,4559,4742,5186,5299,5854
%N A135257 Smallest semiprimes such that a(j) - a(k) are all different.
%C A135257 Semiprime analog of A079848. This is the slowest-growing semiprime B2 sequence (see A005282). The difference set through a(n) must have cardinality exactly C(n,2) = n*(n+1)/2 = A000217(n-1).
%e A135257 a(1) = 4, the smallest semiprime (A001358(1)).
%e A135257 a(2) = 6 = A001358(2); the difference set so far is {2}.
%e A135257 a(3) = 9 = A001358(3); the difference set so far is {2,3,5}.
%e A135257 a(4) = 10 = A001358(4); the difference set so far is {1,2,3,4,5,6}.
%e A135257 a(5) can't be 14 = A001358(5) because 14-10 =4, in the difference set through a(4); can't be 15 = A001358(6) because 15-10 =5, in the difference set through a(4)...
%e A135257 a(5) = 21 = A001358(7); the difference set so far is {1,2,3,4,5,6,11,12,15,17}.
%e A135257 a(6) = 34 = A001358(12); the difference set so far is {1,2,3,4,5,6,11,12,13,15,17,24,25,28,30}.
%p A135257 A135257 := proc(nmax) local a,anext,diffset,good,an ; a := [4,6] ; diffset := {2} ; while nops(a) < nmax do for anext from op(-1,a)+1 do if numtheory[bigomega](anext) = 2 then good := true ; for an in a do if ( anext-an) in diffset then good := false ; break ; fi ; od; if good then for an from 1 to nops(a) do diffset := diffset union { anext-op(an,a) } ; od; a := [op(a),anext] ; break ; fi ; fi ; od ; od: a ; end: A135257(60) ; # _R. J. Mathar_, Jan 08 2008
%o A135257 (Python)
%o A135257 from itertools import count, islice
%o A135257 from sympy import factorint
%o A135257 def A135257_gen(): # generator of terms
%o A135257     aset2, alist = set(), []
%o A135257     for k in count(0):
%o A135257         if sum(factorint(k).values()) == 2:
%o A135257             bset2 = set()
%o A135257             for a in alist:
%o A135257                 if (b:=k-a) in aset2:
%o A135257                     break
%o A135257                 bset2.add(b)
%o A135257             else:
%o A135257                 yield k
%o A135257                 alist.append(k)
%o A135257                 aset2.update(bset2)
%o A135257 A135257_list = list(islice(A135257_gen(),30)) # _Chai Wah Wu_, Sep 11 2023
%Y A135257 Cf. A000217, A001358, A005282, A079848.
%K A135257 nonn
%O A135257 1,1
%A A135257 _Jonathan Vos Post_, Dec 01 2007
%E A135257 Corrected and extended by _R. J. Mathar_, Jan 08 2008