[Programmers] 소수 찾기
Python
def solution(n):
num = set(range(2, n + 1))
for i in range(2, n + 1):
if i in num:
num -= set(range(2 * i, n + 1, i))
return len(num)
def solution(n):
num = set(range(2, n + 1))
for i in range(2, n + 1):
if i in num:
num -= set(range(2 * i, n + 1, i))
return len(num)
댓글남기기