def run(): result, i = 0, 1 primes = prime_list(50) while number_of_divisors(result, primes) < 500: result += i i += 1 return result
def run(): def truncatable(n, psieve): if n < 23: return False left = str(n) right = str(n) while left != '': if not psieve[int(left)]: return False left = left[1:] while right != '': if not psieve[int(right)]: return False right = right[:-1] return True primes = prime_list(999983) psieve = sieve(999983) result = 0 count = 0 n = 23 for n in primes: if truncatable(n, psieve): count += 1 result += n if count == 11: break return result
def run(): def circular_prime(n, psieve): if n < 10: return True num = str(n) if '2' in num or '4' in num or '6' in num or '8' in num or '0' in num: return False for i in range(len(num)): num = num[1:] + num[:1] if not psieve[int(num)]: return False return True result = 0 primes = prime_list(1000000) psieve = sieve(1000000) for i in primes: if circular_prime(i, psieve): result += 1 return result
def run(): primes = prime_list(2000000) return sum(primes)