OFFSET
1,1
COMMENTS
EXAMPLE
a(1) = 4, the smallest semiprime (A001358(1)).
a(2) = 6 = A001358(2); the difference set so far is {2}.
a(3) = 9 = A001358(3); the difference set so far is {2,3,5}.
a(4) = 10 = A001358(4); the difference set so far is {1,2,3,4,5,6}.
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)...
a(5) = 21 = A001358(7); the difference set so far is {1,2,3,4,5,6,11,12,15,17}.
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}.
MAPLE
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
PROG
(Python)
from itertools import count, islice
from sympy import factorint
def A135257_gen(): # generator of terms
aset2, alist = set(), []
for k in count(0):
if sum(factorint(k).values()) == 2:
bset2 = set()
for a in alist:
if (b:=k-a) in aset2:
break
bset2.add(b)
else:
yield k
alist.append(k)
aset2.update(bset2)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jonathan Vos Post, Dec 01 2007
EXTENSIONS
Corrected and extended by R. J. Mathar, Jan 08 2008
STATUS
approved