Веселин обнови решението на 02.05.2012 22:09 (преди над 12 години)
+def primes():
+ number = 2
+ while True:
+ if all([number % divisor for divisor in range(2, number)]):
+ yield number
+ number += 1
+
+
+def semiprimes():
+ number = 4
+ while True:
+ for i in range(2, number):
+ if number % i == 0:
+ if all([i % divisor for divisor in range(2, i)]):
+ if all([int(number / i) % divisor \
+ for divisor in range(2, int(number / i))]):
+ yield number
+ break
+ number += 1