@@ -0,0 +1,767 @@
+#!/usr/bin/env python3%0A%0Afrom functools import *%0Afrom itertools import *%0Aimport operator%0A%0A@lru_cache(maxsize=None)%0Adef is_prime(number):%0A    if number %3C= 0:%0A        return False%0A    for d in range(2, round(number**0.5) + 1):%0A        if number %25 d == 0:%0A            return False%0A    return True%0A%0Adef num_quad_primes(a, b):%0A    return len(list(takewhile(is_prime, ((n+a)*n+b for n in count(0)))))%0A%0Adef product(sequence):%0A    return reduce(operator.mul, sequence)%0A%0Acoeffs = ((a, b)%0A          # n = 0 =%3E n%5E2 + a*n + b = b =%3E b is prime%0A          for b in range(2, 1000) if is_prime(b)%0A           # n = 1 =%3E n%5E2 + a*n + b = a+b+1 =%3E a+b+1 is prime%0A          for a in range(-b, 1000) if is_prime(a+b+1))%0A%0Aprint(product(max(coeffs, key=lambda pair: num_quad_primes(*pair))))%0A

Solve problem 27