#P1937A. Shuffle Party
Shuffle Party
No submission language available for this problem.
Description
You are given an array . Initially, for each .
The operation for an integer is defined as follows:
- Let be the largest divisor of which is not equal to itself. Then swap the elements and .
Suppose you perform for each in this exact order. Find the position of in the resulting array. In other words, find such that after performing these operations.
An integer is a divisor of if there exists an integer such that .
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The only line of each test case contains one integer () — the length of the array .
For each test case, output the position of in the resulting array.
Input
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The only line of each test case contains one integer () — the length of the array .
Output
For each test case, output the position of in the resulting array.
Note
In the first test case, the array is and there are no operations performed.
In the second test case, changes as follows:
- Initially, is .
- After performing , changes to (the elements being swapped are underlined).
- After performing , changes to .
- After performing , changes to .
Finally, the element lies on index (that is, ). Thus, the answer is .