10 and 11 solutions

This commit is contained in:
JellyWX
2017-12-21 18:33:30 +00:00
parent 42c8b5f771
commit 6cf3070bb4
2 changed files with 97 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
'''nums = [i for i in range(2,20000)]
primes = 0
while len(nums) > 0:
prime = nums.pop(0)
print(prime)
primes += prime
for n in nums:
if n % prime == 0:
nums.remove(n)'''
primes = []
for n in range(2,20000):
for p in primes:
if n % p == 0:
break
if n < p*p:
primes.append(n)
break
else:
primes.append(n)
print(sum(primes))