import sys
import collections
import heapq
import functools
import itertools
import re
import math
import bisect
erathos = [True] * 1000001
def find_prime(n):
erathos[1] = False
for i in range(2, int(math.sqrt(n+1))+1):
for j in range(i*2, n+1, i):
erathos[j] = False
def count_prime(start, end):
count = 0
for i in range(start, end + 1):
if erathos[i]:
count += 1
return count
def solution(n):
find_prime(n)
return count_prime(1, n)
에라토스테네스의 체를 이용해서 풀었다.