[WIP] too slow
This commit is contained in:
parent
6c0a3d967f
commit
037f4c0f8d
@ -1,5 +1,3 @@
|
|||||||
testing
|
|
||||||
|
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Created on 13 Oct 2021
|
Created on 13 Oct 2021
|
||||||
@ -11,7 +9,8 @@ Solution for problem 60 of Project Euler
|
|||||||
https://projecteuler.net/problem=60
|
https://projecteuler.net/problem=60
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from utils import timeit
|
from itertools import permutations
|
||||||
|
from utils import timeit, list_primes
|
||||||
|
|
||||||
|
|
||||||
@timeit("Problem 60")
|
@timeit("Problem 60")
|
||||||
@ -27,7 +26,17 @@ def compute():
|
|||||||
concatenate to produce another prime.
|
concatenate to produce another prime.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Your code goes here
|
primes_list = list_primes(10_000)
|
||||||
|
|
||||||
|
for nums in permutations(primes_list, 5):
|
||||||
|
for n1, n2 in permutations(nums, 2):
|
||||||
|
if int(str(n1) + str(n2)) not in primes_list:
|
||||||
|
break
|
||||||
|
primes = sum(nums)
|
||||||
|
print(nums)
|
||||||
|
# break
|
||||||
|
|
||||||
|
return primes
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user