ICPC 2013 · Problem D · Factors

37th ICPC · Saint Petersburg, Russia

Statement

Time Limit: 2 seconds

The fundamental theorem of arithmetic states that every integer greater than 1 can be uniquely repre- sented as a product of one or more primes. While unique, several arrangements of the prime factors may be possible. For example:

10=2510 = 2\cdot 5 20=22520 = 2\cdot 2\cdot 5

=52= 5\cdot 2 =252= 2\cdot 5\cdot 2

=522= 5\cdot 2\cdot 2

Let f(k)f(k) be the number of different arrangements of the prime factors of kk. So f(10)=2f(10) = 2 and f(20)=3f(20) = 3.

Given a positive number nn, there always exists at least one number kk such that f(k)=nf(k) = n. We want to know the smallest such kk.

Input

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

Output

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

Sample Input 1

1
2
3
105

Sample Output 1

1 2
2 6
3 12
105 720

ACM-ICPC World Finals 2013 Problem D: Factors

No official solution in the source collection.