8.255400000000204e-05초 걸렸음!
def is_prime_01(num):
for i in range(2, num):
if num % i == 0:
return False
return True
3.030700000000025e-05초 걸렸음!
def is_prime_02(num):
i = 2
while i*i <= num:
if num % i == 0:
return False
i += 1
return True
def solution(num):
nums = set(range(2, num+1))
for i in range(2, num+1):
if i in nums:
nums -= set(range(i*i, num+1, i))
return len(nums)