code_games/primes.py

16 lines
322 B
Python
Raw Normal View History

2022-05-06 20:07:29 +00:00
primes = [2]
counter = 1
while counter <= 2000000:
counter += 2
for x in primes:
if x * x > counter:
# print(str(counter) + " found")
primes += [counter]
break
elif counter % x == 0:
break
counter = 0
for x in primes:
counter += x
print(counter)