동작 과정
1. 2부터 N까지의 모든 자연수를 나열
2. 남은 수 중에서 아직 처리하지 않은 가장 작은 수 i를 찾는다
3. 남은 수 중에서 i의 배수를 모두 제거(i는 제거하지 않는다)
4. 더 이상 반복할 수 없을 때까지 2번과 3번의 과정을 반복한다
import sys
import math
input = sys.stdin.readline
a,b = map(int,input().split())
A = [0] * (10**7 + 1)
for i in range(2, len(A)):
A[i] = i
for i in range(2, int(math.sqrt(len(A)) + 1)):
if A[i] == 0:
continue
for j in range(i * 2, len(A), i):
A[j] = 0
result = 0
for i in range(2, 10**7 + 1):
if A[i] != 0:
temp = A[i]
while A[i] <= b / temp:
if A[i] >= a / temp:
result += 1
temp *= A[i]
print(result)
글 잘 봤습니다, 많은 도움이 되었습니다.