(n)
| 7 | |
| 8 | from math import sqrt |
| 9 | def SOE(n): |
| 10 | check = round(sqrt(n)) #Need not check for multiples past the square root of n |
| 11 | |
| 12 | sieve = [False if i <2 else True for i in range(n+1)] #Set every index to False except for index 0 and 1 |
| 13 | |
| 14 | for i in range(2, check): |
| 15 | if(sieve[i] == True): #If i is a prime |
| 16 | for j in range(i+i, n+1, i): #Step through the list in increments of i(the multiples of the prime) |
| 17 | sieve[j] = False #Sets every multiple of i to False |
| 18 | |
| 19 | for i in range(n+1): |
| 20 | if(sieve[i] == True): |
| 21 | print(i, end=" ") |
nothing calls this directly
no outgoing calls
no test coverage detected