Historic Breakthrough
Time limit2sMemory limit512 MB
Given m, find n such that m equals the sum of integers in 1..n coprime to n, which also equals n*phi(n)/2.
- Level
Hard8 of 10
- Topics
- Number theory, Math, Implementation, Brute force
- Solved
- No attempts yet
Problem
Rikka is taking the undergraduate cryptography course this year. In class, it is mentioned that a new method of factorization was recently discovered and is regarded as a historic breakthrough in cryptography. Rikka believes that comparable algorithms exist for some specific class of numbers with simpler goals.
Now you are asked to design and implement such a "factorization" algorithm: given an integer , print an integer such that
It is guaranteed that such an exists in every test case.
Input
The first line of input contains an integer (), the number of test cases.
The -th of the following lines contains a single integer ().
Output
For each test case, print an integer for the corresponding . It is guaranteed that the answer exists in every test case. If there are several possible answers, print any one of them.