%time # python 2.6.X, sage 4.5.2, seq id:A100959 from os.path import expanduser lo = 2 hi = 14 * 10^3 nonsemip = [1] for a in xrange(lo,hi+1): lst = list(factor(a)) if len(lst)==1: if lst[0][1]==2: continue elif len(lst)==2: if lst[0][1]==1 and lst[1][1]==1: continue nonsemip.append(a) with open(expanduser("~/B100959.txt"), 'w') as fp: for i in xrange(10^4): print >> fp, "%d" % nonsemip[i] fp.close() del(fp)