Esempio n. 1
0
from helpers import is_prime_sieve
is_prime = is_prime_sieve(10000)

for i in range(1000, 10000 - 6660):
    if is_prime(i):
        a = sorted(str(i))
        b = sorted(str(i + 3330))
        c = sorted(str(i + 6660))
        if a == b == c and is_prime(i + 3330) and is_prime(i + 6660):
            print i, i + 3330, i + 6660
Esempio n. 2
0
from helpers import is_prime_sieve

def term(m,n):
    #mth term along nth diagonal
    return 1 + (2*n)*m + 4*(m-1)*m

is_prime = is_prime_sieve(term(13121,4))

m = 0
termcount = 0
while True:
    m += 1
    termcount += len([1 for n in range(1,5) if is_prime(term(m,n))])
    ratio = termcount/(m*4.0+1)
    if ratio < 0.10:
        print m*2+1, ratio
        break
Esempio n. 3
0
import itertools
from helpers import is_prime_sieve

is_prime = is_prime_sieve(7654321)

print reduce(
    max,
    filter(is_prime,
           map(lambda x: int(''.join(x)), itertools.permutations('1234567'))))
Esempio n. 4
0
from helpers import is_prime_sieve
is_prime = is_prime_sieve(10000)

for i in range(1000,10000-6660):
    if is_prime(i):
        a = sorted(str(i))
        b = sorted(str(i + 3330))
        c = sorted(str(i + 6660))
        if a == b == c and is_prime(i+3330) and is_prime(i+6660):
            print i, i + 3330, i + 6660
Esempio n. 5
0
import itertools
from helpers import is_prime_sieve

is_prime = is_prime_sieve(7654321)

print reduce(max, filter(is_prime, map(lambda x: int(''.join(x)), itertools.permutations('1234567'))))