from myfunc import prime_list sum = 0 for i in prime_list(): if (i > 2000000): break sum += i print sum
from myfunc import prime_list from itertools import islice print islice(prime_list(), 10001, 10002).next()
from myfunc import is_prime, prime_list bestcount = 0 bestproduct = 0 for n in xrange(0,200): print "n=",n for a in xrange(-1000,1000): count = 0 for b in prime_list(1000): if (((n**2)+(a*n)+b) > 0): if (is_prime((n**2)+(a*n)+b)): count += 1 if (count > bestcount): bestcount, bestproduct = count, a*b print bestproduct
import myfunc count = 0 for i in myfunc.prime_list(): if i > 1000000: break tmp = myfunc.shift_digits(str(i), 1) circ = True while int(tmp) != i: if not myfunc.is_prime(int(tmp)): circ = False tmp = myfunc.shift_digits(tmp, 1) if circ: count += 1 print count