18 lines
411 B
Python
18 lines
411 B
Python
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)) |