def solution(): """Bryukh's solution""" best = (1, 1, 1) for a in xrange(-999, 1000): for b in xrange(-999, 1000): i = 0 while isprime(i**2 + a*i + b): i += 1 if i-1 > best[0]: best = (i-1, a, b) return best[1] * best[2]
def solution(): """ Bryukh's solution """ res = [] for i in xrange(2, 10): perm_list = permutations(range(1, i + 1)) for var in perm_list: pandigit = int(''.join([str(x) for x in var])) if isprime(pandigit): res.append(pandigit) print pandigit return max(res)
def solution(): """ Bryukh's solution """ res = [] for i in xrange(2, 10): perm_list = permutations(range(1, i+1)) for var in perm_list: pandigit = int(''.join([str(x) for x in var])) if isprime(pandigit): res.append(pandigit) print pandigit return max(res)
def solution(): """ Bryukh's solution >>> solution() 26241 """ common = 1 begin = 1 inc = 2 prime = 0 while True: prime += sum([1 for i in xrange(1, 5) if isprime(begin+(inc*i))]) common += 4 if (float(prime) / common) < 0.1: return inc+1 begin += inc*4 inc += 2
def solution(): """ Bryukh's solution >>> solution() 26241 """ common = 1 begin = 1 inc = 2 prime = 0 while True: prime += sum([1 for i in xrange(1, 5) if isprime(begin + (inc * i))]) common += 4 if (float(prime) / common) < 0.1: return inc + 1 begin += inc * 4 inc += 2
def not_conc_prime(n1, n2): return not isprime(conc(n1, n2)) or not isprime(conc(n2, n1))