Дейвид обнови решението на 02.05.2012 15:16 (преди над 12 години)
+def primecheck(number):
+ number *= 1.0
+ if number % 2 == 0 and number != 2 or number % 3 == 0 and number != 3:
+ return False
+ for divs in range(1, int((number ** 0.5 + 1) / 6.0 + 1)):
+ if number %(6 * divs - 1) == 0:
+ return False
+ if number %(6 * divs + 1) == 0:
+ return False
+ return True
+
+def primes():
+ yield 2
+ number = 3
+ while True:
+ if ( primecheck(number) ):
+ yield number
+ number += 1
+
+def semiprimes():
+ tempstore = [x for x in range(2, 100) if primecheck(x)]
+ results = [x * y for x in tempstore for y in tempstore]
+ result = sorted(set(results))
+ for num in result:
+ yield num
+ #Kire haresva li ti krupkata