Esempio n. 1
0
def main():
    s = time.time()

    return [
        find_truncatable_primes(mwmath.build_prime_list(1000000)),
        time.time() - s
    ]
Esempio n. 2
0
The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and
concatenating them in any order the result will always be prime. For example,
taking 7 and 109, both 7109 and 1097 are prime. The sum of these four primes,
792, represents the lowest sum for a set of four primes with this property.

Find the lowest sum for a set of five primes for which any two primes concatenate
to produce another prime.
'''

import time
import mwmath
import re

s = time.time()

p_list = mwmath.build_prime_list(10000)

print time.time()-s
t = time.time()

for p_1 in p_list:
    for p_2 in p_list:
        if p_2<=p_1:
            continue
        if not mwmath.concat_prime_list(p_2,[p_1],p_list):
            continue
        for p_3 in p_list:
            if p_3<=p_1:
                continue
            if p_3<=p_2:
                continue
Esempio n. 3
0
def main():
    s = time.time()
        
    return [find_truncatable_primes(mwmath.build_prime_list(1000000)),time.time()-s]
Esempio n. 4
0
'''Project Euler test
'''
import mwmath

p = []
ii = 100
while len(p) < 50:
    p = mwmath.build_prime_list(ii)
    ii += 5

print p
Esempio n. 5
0
'''Project Euler test
'''
import mwmath

p = []
ii = 100
while len(p)<50:
    p = mwmath.build_prime_list(ii)
    ii+=5

print p