Problem list
Log in
#icpc00026 · ICPC World Finals 2013

Factors

Platinum II 2.0 s 1024 MB

The fundamental theorem of arithmetic states that every integer greater than 1 can be uniquely rep$re- se$nted as a product of one or more primes. While unique, several arrangements of the prime factors may be possible. For example: $10 = 2 \cdot 5 20 = 2 \cdot 2 \cdot 5 = 5 \cdot 2 = 2 \cdot 5 \cdot 2 = 5 \cdot 2 \cdot 2$ Let $f$($k$) be the number of different arrangements of the prime factors of $k$. So $f$(10) = 2 and $f$(20) = 3. Given a positive number $n$, there always exists at least one number $k$ such that $f$($k$) = $n$. We want to know the smallest such $k$.

Input

The input consists of at most 1 000 test cases, each on a separate line. Each test case is a positive integer $n < 2^{63}$.

Output

For each test case, display its number $n$ and the smallest number $k > 1$ such that $f$($k$) = $n$. The numbers in the input are chosen such that $k < 2^{63}$.

Example 1

Input
1
2
3
105
Output
1 2
2 6
3 12
105 720
Source
ICPC World Finals 2013
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code