PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000040. Liệt kê số nguyên tố (Print Prime Numbers)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Liệt kê số nguyên tố (Print Prime Numbers)

Print Prime Numbers

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer NN, find every prime number not greater than NN and list them in increasing order. A prime is an integer greater than 11 whose only positive divisors are 11 and itself.

Input

One line containing the integer NN.

Output

Print the primes from 22 through NN in ascending order, on one line, separated by spaces.

Subtasks

  • Subtask 1 (20 points): 2≤N≤1002\le N\le 100.
  • Subtask 2 (30 points): 2≤N≤10002\le N\le 1000.
  • Subtask 3 (50 points): 2≤N≤30002\le N\le 3000.

Examples

Input

10

Output

2 3 5 7

Explanation

For N=10N=10, the primes are 2,3,5,72,3,5,7. The integers 4,6,8,9,104,6,8,9,10 are composite, so the program prints 2 3 5 7 in increasing order.