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

#SP0000081. Liệt kê thừa số nguyên tố từ 2 đến 100000 (Prime Factors)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Liệt kê thừa số nguyên tố từ 2 đến 100000 (Prime Factors)

Prime Factors

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

For each integer nn from 22 through 100000100000, print all distinct prime divisors of nn in increasing order. The output must consist of exactly 9999999999 lines corresponding to n=2,3,…,100000n=2,3,\ldots,100000. Every line has the form n: p1 p2 ... pk with one space between adjacent numbers. There is no input.

Input

There is no input.

Output

Print exactly 9999999999 lines. The line for nn begins with n: followed by the distinct prime divisors in increasing order, separated by spaces.

Subtasks

  • Subtask 1 (100 points): 2≤n≤1000002\le n\le100000 for every printed integer nn (no input).

Examples

Illustrative output excerpt (first five lines only)

2: 2
3: 3
4: 2
5: 5
6: 2 3

Explanation

The complete output is long; here are only the first five lines (not the complete output): 2: 2, 3: 3, 4: 2, 5: 5, 6: 2 3. Since 4=224=2^2, the prime 22 appears only once; 6=2⋅36=2\cdot3 yields 2,32,3.