Solution to problem 10
This commit is contained in:
parent
d973833082
commit
24835a4496
30
src/Python/Problem010.py
Normal file
30
src/Python/Problem010.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Created on 26 Aug 2017
|
||||||
|
|
||||||
|
@author: David Doblas Jiménez
|
||||||
|
@email: daviddoji@pm.me
|
||||||
|
|
||||||
|
Solution for problem 10 of Project Euler
|
||||||
|
https://projecteuler.net/problem=10
|
||||||
|
"""
|
||||||
|
|
||||||
|
import math
|
||||||
|
from utils import timeit, list_primes
|
||||||
|
|
||||||
|
|
||||||
|
@timeit("Problem 10")
|
||||||
|
def compute():
|
||||||
|
"""
|
||||||
|
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
|
||||||
|
|
||||||
|
Find the sum of all the primes below two million.
|
||||||
|
"""
|
||||||
|
ans = sum(list_primes(1_999_999))
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
print(f"Result for Problem 10: {compute()}")
|
Loading…
x
Reference in New Issue
Block a user