feat(solution): problem #10

main
steven 2023-07-31 14:22:13 -04:00
parent 237c116253
commit 4843a4fffc
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
import math
primeSum = 0
currentNumber = 1
limit = 2000000
def is_prime(maybeprime):
for i in range(2, math.floor(math.sqrt(maybeprime) + 1)):
if maybeprime % i == 0:
return False
return True
while currentNumber < limit:
currentNumber += 1
if is_prime(currentNumber):
primeSum += currentNumber
print("The sum of all primes below two million is: " + str(primeSum))