from primeGen import get_primes PRIMELST = (get_primes(100000)) def gen_inc(n): trial = [n, n + 3330, n + 3330 * 2] if len({''.join(sorted(str(num))) for num in trial}) == 1 and len(filter(lambda x: x in PRIMELST, trial)) == 3: return trial return False for num in PRIMELST: if gen_inc(num): print gen_inc(num) if num > 9999: break
from primeGen import get_primes def quad(n, a, b): return n * n + a * n + b primes = get_primes(100000) best = 0 counter = 0 coef_a = 0 coef_b = 0 #results = set() for a in range(-999, 1000): for b in range(-999, 1000): n = 0 while True: if not (quad(n, a, b) in primes): break else: counter += 1 n += 1 #results.add(quad(n, a, b)) if counter > best: best = counter coef_a = a coef_b = b counter = 0 # for i in range(15): # print quad(i, 999, 999)
import primeGen def gen_rotations(n): result = set() temp = str(n) for idx in range(len(temp)): rotation = int(temp[idx:] + temp[:idx]) result.add(rotation) return result primes = primeGen.get_primes(1000000) result = set() for num1 in primes: #print num1 for num2 in gen_rotations(num1): flag = True # print '2nd loop', num2, result if not (num2 in primes): flag = False break if flag: result.add(num1) print len(result)