#CCBOTPBA0000059. In thừa số kèm số mũ (Prime Factors with Exponents)
In thừa số kèm số mũ (Prime Factors with Exponents)
Prime Factors with Exponents
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer , express it as a product of powers of primes. For each prime factor , let be the multiplicity of in the factorization (the largest exponent such that divides ). Print each pair on its own line, with prime factors in strictly increasing order. Print each distinct prime exactly once.
Input
One line contains one integer .
Output
Print two integers and separated by one space on each line, in increasing order of .
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input:
360
Output:
2 3
3 2
5 1
Explanation: Since , print prime-exponent pairs (2,3), (3,2), (5,1) in increasing prime order.
Example 2
Input:
13
Output:
13 1
Explanation: 13 is prime, so its factorization contains just the pair 13 1.
Example 3
Input:
64
Output:
2 6
Explanation: Dividing 64 by 2 six times reaches 1, hence and the only line is 2 6.