Example #1
0
def circular_prime(x):
    if is_prime_c(x):
        s = str(x)
        for n in xrange(len(s) - 1):
            s = s[1:] + s[0]
            if not is_prime_c(int(s)):
                return False
        else:
            return True
Example #2
0
from primes import is_prime_c

(A, B, C) = (0, 0, 0)
for a in xrange(-999, 999, 1):
    for b in xrange(-999, 999, 1):
        (c, p) = (0, True)
        while p is True:
            N = c * c + a * c + b
            if N <= 0:
                break
            p = is_prime_c(N)
            c += 1
        c -= 1
        if c > C:
            (A, B, C) = (a, b, c)

print A * B