Factorial Decomposition
Submit solution
Points:
1
Time limit:
1.0s
Memory limit:
256M
Problem type
Allowed languages
C++, Python
Factorial Prime Factorization Problem
Given an integer N, factorize the factorial N! into its prime factors. Output the result in the form of the Fundamental Theorem of Arithmetic: for each prime factor pi, output pi and its exponent ci.
Input Format
A single integer N.
Output Format
Several lines, each containing a pair pi ci, meaning pici appears in the factorization of N!. Output the pairs in increasing order of pi.
Data Range
3 ≤ N ≤ 106
Sample Input
5
Sample Output
2 3
3 1
5 1
Sample Explanation
5! = 120 = 23 · 3 · 5
Comments