To understand the problem,let us consider these examples first:
46 = (22)6 = 212 = (23)4 = 84 = 163 = 4096.
Thus,we can say that 46,212,84 and 163 are same.
273 = 39 = 19683
so, both 273 and 39 are identical.
Now the problem is, for any given pair of ab how to compute all others possible (if any)xy where, ab = xy.I am interested in an algorithm that can be efficiently implemented in C/C++.
For example:
If the inputs are like this:
4,6
desired output :(2,12),(8,4)
8,4
desired output :(2,12),(2,6)
27,3
desired output :(3,9)
12,6
desired output :(144,3),(1728,2)
7,5
desired output : No duplicate possible