Ejemplo n.º 1
0
def eight_prime_family(prime,rd):
    c=0
    for digit in '0123456789':
        n=int(prime.replace(rd,digit))
        if (n>100000 and intx(n).isPrime()):
            c=c+1
    return c==8
Ejemplo n.º 2
0
def eight_prime_family(prime, rd):
    c = 0
    for digit in '0123456789':
        n = int(prime.replace(rd, digit))
        if (n > 100000 and intx(n).isPrime()):
            c = c + 1
    return c == 8
Ejemplo n.º 3
0
def problem_51():
    for prime in intx(1000000).sievePrime():
        if prime>100000:
            s=str(prime)
            last_digit=s[5:6]
            if (s.count('0')==3 and eight_prime_family(s,'0') or \
                s.count('1')==3 and last_digit!='1' and eight_prime_family(s,'1') or \
                s.count('2')==3 and eight_prime_family(s,'2')):return s   
Ejemplo n.º 4
0
def problem_51():
    for prime in intx(1000000).sievePrime():
        if prime > 100000:
            s = str(prime)
            last_digit = s[5:6]
            if (s.count('0')==3 and eight_prime_family(s,'0') or \
                s.count('1')==3 and last_digit!='1' and eight_prime_family(s,'1') or \
                s.count('2')==3 and eight_prime_family(s,'2')):
                return s