>>> l = range(2, 101)>>> sorted(set(l).difference(a for i in l for a in l if a!=i and a%i == 0))[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
虽然我建议
a > i不要
a != 0短而快;)
欢迎分享,转载请注明来源:内存溢出
>>> l = range(2, 101)>>> sorted(set(l).difference(a for i in l for a in l if a!=i and a%i == 0))[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
虽然我建议
a > i不要
a != 0短而快;)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)