from __future__ import print_function
from sys import stdin

def printf(str, *args):
	print(str % args, end='')

MAX = 10000
arr = [0 for _ in range(MAX)]

while True:
	printf("정수 n 값을 입력하세요. \n n= ");
	n = int(stdin.readline())
	for i in range(0, n):
		arr[i] = i+1
	for i in range(0, n):
		if arr[i]==1:
			arr[i] = 0
		else:
			if arr[i] != 0:
				j = 2
				while (i+1)*j<=n:
					arr[(i+1)*j-1]=0
					j += 1
	for i in range(0, n):
		if arr[i]!=0:
			printf("%d " % arr[i])
	printf("\n")

stdin.readline()