Primes less than a number

n = 2000000 primes = [2,3,5,7] k = 11 while n > k: m = k**0.5 for p in primes: if p > m: primes.append(k) break if k%p == 0: break k+=2 print(primes) print(sum(primes)) #sum of primes less than n

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.