Solution for problem 7
This commit is contained in:
34
src/Python/Problem007.py
Normal file
34
src/Python/Problem007.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Created on 28 Jun 2017
|
||||||
|
|
||||||
|
@author: David Doblas Jiménez
|
||||||
|
@email: daviddoji@pm.me
|
||||||
|
|
||||||
|
Solution for problem 7 of Project Euler
|
||||||
|
https://projecteuler.net/problem=7
|
||||||
|
"""
|
||||||
|
|
||||||
|
from utils import timeit, is_prime
|
||||||
|
|
||||||
|
|
||||||
|
@timeit("Problem 7")
|
||||||
|
def compute():
|
||||||
|
"""
|
||||||
|
# Statement
|
||||||
|
"""
|
||||||
|
number = 2
|
||||||
|
primeList = []
|
||||||
|
while len(primeList) < 10001:
|
||||||
|
if is_prime(number):
|
||||||
|
primeList.append(number)
|
||||||
|
number += 1
|
||||||
|
|
||||||
|
ans = primeList[len(primeList)-1]
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
print(f"Result for Problem 7: {compute()}")
|
||||||
Reference in New Issue
Block a user