Hide

Problem C
Fundamental Neighbors

The fundamental theorem of arithmetic says that any natural number greater than one can be written uniquely as the product of prime numbers. For example: 3=31, 4=22, 6=21×31, 72=23×32, and in general,

n=p1e1×p2e2××pkek

for prime numbers p1 through pk and exponents e1 through ek.

For this problem, given an integer n2, determine what we will call the ‘neighbor’ of n. The neighbor is the integer you get by swapping the pi and ei values in the prime factorization of n. That is, if n is written in prime factorization as above, the neighbor of n is

e1p1×e2p2××ekpk.

For example, if n=2000=24×53 then its neighbor is 42×35=3888.

Input

Input is a sequence of up to 20000 integers, one per line. Each integer is in the range 2n<231. Input ends at the end of file.

Output

For each n, print n followed by its neighbor. Each neighbor is in the range [1,231).

Sample Input 1 Sample Output 1
2
3
4
5
6
7
8
9
10
72
200
2 1
3 1
4 4
5 1
6 1
7 1
8 9
9 8
10 1
72 72
200 288
Hide

Please log in to submit a solution to this problem

Log in