Solve problem 187.
This commit is contained in:
19
python/e187.py
Normal file
19
python/e187.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
from lib_prime import primes
|
||||||
|
|
||||||
|
|
||||||
|
def euler_187():
|
||||||
|
r = 0
|
||||||
|
upper = 10**8
|
||||||
|
ps = primes(upper // 2)
|
||||||
|
for i in range(len(ps)):
|
||||||
|
for j in range(i, len(ps)):
|
||||||
|
if ps[i] * ps[j] >= upper:
|
||||||
|
break
|
||||||
|
r += 1
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
solution = euler_187()
|
||||||
|
print("e187.py: " + str(solution))
|
||||||
|
assert(solution == 17427258)
|
||||||
Reference in New Issue
Block a user