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
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
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 from through , print all distinct prime divisors of in increasing order. The output must consist of exactly lines corresponding to . 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 lines. The line for begins with n: followed by the distinct prime divisors in increasing order, separated by spaces.
Subtasks
- Subtask 1 (100 points): for every printed integer (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 , the prime appears only once; yields .