n = 1000000
check = [False, False] + [True]*(n-1)
primes = []
for i in range(2, n+1):
if check[i]==True:
primes.append(i)
for a in range(i*2, n+1, i):
check[a] = False
for i in range(len(primes)):
print(primes[i], end=" ")