def is_truncatable(num): digits = elib.to_digits(num) for i in xrange(1, len(digits)): if not elib.is_prime(elib.from_digits(digits[i:])) or \ not elib.is_prime(elib.from_digits(digits[:i])): return False return True
def main(argv): sum_primes = 0 for i in range(1, 2000000): if (elib.is_prime(i)): sum_primes += i print " ANS = " + str(sum_primes)
import elib import itertools for i in range(9, 1, -1): for perm in itertools.permutations(range(i, 0, -1)): n = elib.from_digits(perm) if elib.is_prime(n): print(n) return
def check_coefs(a, b): i = 0 while elib.is_prime(i * i + i * a + b): i += 1 return i