Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Curso primes
import math
def erathostenes(n):
primes = list(range(2, n+1))
i = 2
while(i <= int(math.sqrt(n))):
if i in primes:
for j in list(range(i*2, n+1, i)):
if j in primes:
i += 1
return primes
number = 10
primes = erathostenes(number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.