import sys
input = sys.stdin.readline
M, N = map(int, input().split())
n = N
a = [False, False] + [True] * (n-1)
primes = []
for i in range(2, n + 1):
if a[i]:
primes.append(i)
for j in range(2 * i, n + 1, i):
a[j] = False
for num in primes:
if num >= M:
print(num)
'알고리즘' 카테고리의 다른 글
Divide and Conquer Square (0) | 2024.10.14 |
---|---|
MST (0) | 2024.10.11 |
Prefix Sum, Prefix Sum of Matrix (0) | 2024.10.11 |
Topology Sort (0) | 2024.10.11 |
Segment Tree (0) | 2024.10.11 |