Esempio n. 1
0
def solve():
    for prime in generate_primes():
        for c in str(prime):
            mask = str(prime).replace(c, '*')
            family = prime_star_variations(mask)
            if len(family) == 8:
                return min(family)
Esempio n. 2
0
def primes_between(start, end):
    lst = []
    for prime in generate_primes():
        if prime > end:
            return lst
        if prime >= start:
            lst.append(prime)
Esempio n. 3
0
def solve():
    largest = 0
    for prime in generate_primes():
        if is_pandigital(prime):
            largest = prime

        if prime > 10000000:
            return largest
Esempio n. 4
0
def solve():
    numbers = []
    for prime in generate_primes():
        if is_truncatable_prime(prime):
            numbers.append(prime)
            if len(numbers) >= 11:
                break
    return sum(numbers)
Esempio n. 5
0
def circular_primes_below(limit):
    circular_primes = []
    for prime in generate_primes():
        p = is_circular_prime(prime)
        if prime > limit:
            break
        if p:
            circular_primes += p
    return set(circular_primes)
Esempio n. 6
0
def has_problem_property(n):
    s = str(n)
    if len(s) == 9:
        s = '0' + s
    i = 1
    for prime in generate_primes():
        if prime > 17:
            return True
        part = int(s[i:i + 3])
        if not part % prime == 0:
            return False
        i += 1
Esempio n. 7
0
def solve():
    i = 7.0
    while True:
        i += 2.0
        if is_prime(i):
            continue

        for prime in generate_primes():
            if prime > i:
                return i
            r = i - prime
            if not r % 2 == 0:
                continue

            r = math.sqrt(r / 2.0)
            if r == math.floor(r):
                break
    pass
Esempio n. 8
0
def prime_at(nr):
    prime_nr = 1
    for prime in generate_primes():
        if prime_nr == nr:
            return prime
        prime_nr += 1
Esempio n. 9
0
from problem003 import generate_primes

if __name__ == '__main__':
    primes = generate_primes(2000000)
    total = 0
    for prime in primes:
        total += prime
    print(total)