Димитър обнови решението на 03.05.2012 17:12 (преди над 12 години)
+def primes():
+ i=0
+ while 42==42:
+ i+=1
+ k=0
+ for j in range(i):
+ if i%(j+1)==0 and i!=(j+1) and (j+1)!=1:
+ k+=1
+ if k==0:
+ yield i
+
+
+
+def semiprimes():
+ list=[]
+ sp=[]
+ for i in range(1000):
+ k=0
+ for j in range(i+1):
+ if (i+1)%(j+1)==0 and (i+1)!=(j+1) and (j+1)!=1:
+ k=k+1
+ if k==0:
+ list.append(i+1)
+ for n in list:
+ for p in list:
+ if list.index(n)>0 and list.index(p)>0:
+ sp.append(n*p)
+ sp.sort()
+ for i in range(len(sp)-1):
+ if sp[i]!=sp[i+1]:
+ yield (sp[i])