Пример #1
0
def main():
    numthry.sieve(100^2+bound*100+bound)
    best = (0,0,0)
    for a in range(-bound,bound+1):
        for b in range(-bound,bound+1):
            if numthry.isprime(b):
                n = 0
                while numthry.isprime(n*n + a*n + b):
                    n += 1
                if n > best[2]:
                    best = (a, b, n)
    print(best)
Пример #2
0
def main():
    numthry.sieve(100^2+bound*100+bound)
    best = (0,0,0)
    for a in range(-bound,bound+1):
        for b in range(-bound,bound+1):
            if numthry.isprime(b):
                n = 0
                while numthry.isprime(n*n + a*n + b):
                    n += 1
                if n > best[2]:
                    best = (a, b, n)
    print(best)
Пример #3
0
def main():
    numthry.sieve(1000000)
    count = 0
    total = 0
    n = 10

    while count < 11:
        if numthry.isprime(n):
            s = str(n)
            truncs = [s[i:] for i in range(len(s))] + [s[:i+1] for i in range(len(s)-1)]
            if all(numthry.isprime(int(t)) for t in truncs):
                total += n
                count += 1
        n += 1
    print(total)
Пример #4
0
def main():
    numthry.sieve(1000000)
    count = 0
    total = 0
    n = 10

    while count < 11:
        if numthry.isprime(n):
            s = str(n)
            truncs = [s[i:] for i in range(len(s))
                      ] + [s[:i + 1] for i in range(len(s) - 1)]
            if all(numthry.isprime(int(t)) for t in truncs):
                total += n
                count += 1
        n += 1
    print(total)