#P0023. 分解质因数
分解质因数
1. Description
Code to factorize a given integer.
- First, code a function to check if the input is prime
- Second, code a function to find and print all the prime factors in ascending order
For example:
12 = 2 * 2 * 3
19 = 19
2. Input & Output
Input:
- An integer
N - Use
input()as input. Notice that the value you get frominput()is a string
Output:
- A string like
N = p1 * p2 * ... - Prime factors are in ascending order
- Add one space between all the numbers,
=, and* - Use
print()for your output
Example
# Input:
1987
# Output:
1987 = 1987
# Input:
200
# Output:
200 = 2 * 2 * 2 * 5 * 5