aboutsummaryrefslogtreecommitdiff
path: root/python/wip/027-quadratic_primes.py
blob: 8b21cc673316267faaa35fcd6b7dbfab23de8cd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from itertools import count
from helper.prime import is_prime


ab_iter = [(a, b) for b in range(1_001) for a in range(1_000)]

max_product = 0
max_prime_seq = 0
for a, b in ab_iter:
    for n in count():
        if (not is_prime(n**2 + a*n + b)) and n > max_prime_seq:
            max_prime_seq = n
            max_product = a * b
            print(max_product)
            break