Example #1
0
def seq_primes(a, b):
    n = 0
    prime = True
    while prime:
        prime = is_prime(f(a,b,n))
        n += 1
    return n-1
Example #2
0
from gauss import is_prime
from gauss import perms

sup = 0
digs = '987654321'

while 1:
    for perm in perms(digs):
        if is_prime(int(perm)):
            if int(perm) > sup:
                sup = int(perm)
    digs = digs.replace(digs[0], '')
    if sup: print sup; break
Example #3
0
from gauss import is_prime
from gauss import primes

def is_square(n):
    return int(n**.5) == n**.5

n = 33
brk = 0

while 1:
    if not is_prime(n):
        conj = 0
        for prime in primes(2, n):
            if is_square((n - prime)/2):
                conj = 1
    if not conj:
        print n
        break
    n += 2
        
Example #4
0
def gen_primes(n):
    return [x for x in xrange(n) if is_prime(x)]
Example #5
0
from gauss import is_prime

l = []

def trunl(n):
    res = []
    strn = str(n)
    for i in xrange(1, len(strn)):
        res.append(int(strn[:i]))
    return res

def trunr(n):
    res = []
    strn = str(n)
    for i in xrange(1, len(strn)):
        res.append(int(strn[-i:]))
    return res

for prime in primes(8, 10000000):
    if [1 for i in trunl(prime) if is_prime(i)] == [1]*(len(str(prime))-1):
        if [1 for i in trunr(prime) if is_prime(i)] == [1]*(len(str(prime))-1):
            l.append(prime)
        else:
            continue
    else:
        continue
    if len(l) == 11:
        print sum(l)
        break