示例#1
0
from Euler_Functions import prime_eratosthenes, is_prime
from itertools import combinations
import time

start = time.time()

n = 10000
m = 2700000
primes = prime_eratosthenes(m)
primes_set_list = sorted(list(prime_eratosthenes(n)))
seeds = [i for i in primes_set_list if i < 1000]


def comb_primes_test(prime_list, new_prime):
    for tested_prime in prime_list:
        pre = int(str(new_prime) + str(tested_prime))
        if pre < m:
            if pre not in primes:
                return False
        else:
            sqrt = ((pre**0.5) + 1) // 1
            if pre % 2 == 0:
                return False
            else:
                for div in primes_set_list:
                    if div > int(pre**0.5):
                        break
                    elif pre % div == 0:
                        return False
        post = int(str(tested_prime) + str(new_prime))
        if post < m:
示例#2
0
from Euler_Functions import prime_eratosthenes

primes = prime_eratosthenes(10000000)
pan_primes = []

for prime in primes:
    prime_str = str(prime)
    num_set = set([str(i) for i in range(1, len(prime_str) + 1)])
    prime_str_set = set(list(prime_str))
    if len(prime_str_set) != len(prime_str):
        continue
    comb_set = num_set - prime_str_set
    if len(comb_set) == 0:
        pan_primes.append(prime)

print(max(pan_primes))
示例#3
0
from Euler_Functions import Prime_Factors, prime_eratosthenes

quad_counter = 0
seed = 2
primes = prime_eratosthenes(200000)

while quad_counter < 4:
    length = len(Prime_Factors(seed, unique=True, prime_list=primes))
    if length == 4:
        quad_counter += 1
        seed -= 1
        continue
    else:
        quad_counter = 0
        seed += 4

print(seed + 1)