Example #1
0
def main():
    
    gen = gmath.gen_sieve_of_eratosthenes()
    p, primes = 1, []
        
    while p < 10000:
        p = gen.next()
        p2 = p + 3330
        p3 = p + 6660
        if gmath.is_prime(p2) and gmath.is_prime(p3):
            if gmath.is_permutation(p, p2) and gmath.is_permutation(p, p3):
                primes.append([str(p), str(p2), str(p3)])
    return int(''.join(primes[1]))
Example #2
0
def main():
    limit = 1000000
    sums = get_sums(limit)
    t = 1 # num of terms
    result = 1 # max prime
    for i in range(len(sums)):
        for j in range(len(sums)):
            n = sums[j] - sums[i] # sum
            l = j-i # len
            if gmath.is_prime(n) and l > t and n <= limit:
                t = l
                result = n
    return result
Example #3
0
def main():
    sum = 2    # begin at 2, then iterate over only odd numbers
    for i in range(3, 2000001, 2):
        if gmath.is_prime(i):
            sum += i
    return sum
Example #4
0
def main():

    for n in range(7654321, 1, -2):
        if gmath.is_pandigital(n) and gmath.is_prime(n):
            return n
    return None