Example #1
0
def max_prime_list(pair):
    a, b = pair
    prime_seq_len = 0
    n = 0
    while n < b:
        q = n**2 + a*n + b
        if q > 1 and is_prime(q):
            prime_seq_len += 1
            n += 1
        else:
            break
    return prime_seq_len
Example #2
0
def extend_right(right):
    candidates = [int(str(n) + str(p)) for p in right for n in range(1,10)]
    return [p for p in candidates if is_prime(p)]
Example #3
0
def extend_left(left):
    candidates = [a*10 + b for a in left for b in [1, 3, 7, 9]]
    return [p for p in candidates if is_prime(p)]
Example #4
0
def extend(left, right):
    candidates = [a*10 + b%10 for a in left for b in right if str(a)[1:] == str(b)[:-1]]
    return [p for p in candidates if is_prime(p)]