Day 5 - Fascinating functions

4

1 votes
Binary search algorithm, Recruit, Number Theory, Data Structures, Medium-Hard, Mathematics, Approved, Number theory
Problem

Disclaimer: All characters appearing in this question are fictitious. Any resemblance to real person, living or dead, are purely coincidental.

Rahul Gandhi is vexed on the launch of BHIM app. Out of rage to prove himself , he designs some functions, and presents them before the party –

The two functions are X(k) and Y(k).

  • X(k) is defined as the number of positive divisors of k
  • Y(k) = kX(k)

Now, find out the smallest m such that Y(m)=N for some given integer N.

Input Format:

The first line consists of T integers .
Each test case consists of a positive integer N.

Output Format:

For each test case, output the desired result.

Input Constraints:

1T105
2N1018

Note
If no such m exists, then output "-1" (without quotes).

Sample Input
2
4
10
Sample Output
2
-1
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
  • In the first sample we have, X(2)=2 and Y(2)=4. So, the answer is 2
  • In the second sample, there is no k satisfying Y(k) = 10
Editor Image

?