#SP0000271. Phân tích thừa số nguyên tố của số lớn (Factorizing Large Integers)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Phân tích thừa số nguyên tố của số lớn (Factorizing Large Integers)
Factorizing Large Integers
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , express it as a product of prime factors. Write each distinct prime factor once, with an exponent equal to its multiplicity, and list the factors in ascending order.
Input
One line contains the positive integer .
Output
Print one line in the form N = p1^e1 * p2^e2 * ..., replacing N with the input value. Prime factors are in ascending order, separated by *. Omit the exponent when it equals .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
60
Output
60 = 2^2 * 3 * 5
Explanation
Starting from , divide successively by prime factors: ; ; ; . Combine equal factors into powers, omit exponent , write before =, and separate groups with *. The resulting output is 60 = 2^2 * 3 * 5.
Example 2
Input
36
Output
36 = 2^2 * 3^2
Explanation
Starting from , divide successively by prime factors: ; ; ; . Combine equal factors into powers, omit exponent , write before =, and separate groups with *. The resulting output is 36 = 2^2 * 3^2.
Example 3
Input
10007
Output
10007 = 10007
Explanation
Starting from , divide successively by prime factors: . Combine equal factors into powers, omit exponent , write before =, and separate groups with *. The resulting output is 10007 = 10007.