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

#SP0000042. Liệt kê số nguyên tố (Prime Enumeration)

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ố (Prime Enumeration)

Prime Enumeration

Source: LQDOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive integer nn, list all primes in the inclusive interval [1,n][1,n], in increasing order. The number 11 is not prime.

Input

One line containing the positive integer nn.

Output

Print each prime in [1,n][1,n] on a separate line; print no numbers if none exist.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100.
  • Subtask 2 (30 points): 1≤n≤100001\le n\le 10000.
  • Subtask 3 (50 points): 1≤n≤10000001\le n\le 1000000.

Examples

Input

10

Output

2
3
5
7

Explanation

In [1,10][1,10], the number 11 is not prime and 4,6,8,9,104,6,8,9,10 are composite. Thus 2,3,5,72,3,5,7 are printed on four lines.