#P5348. 密码解锁
密码解锁
Description
One day, WD found a very strange combination lock. He remembered that before CX asked him to unlock it, CX told him some numbers. Unfortunately, since WD is really bad at this, he forgot what those numbers were. He only remembers that after numbering them from to , for any positive integer , the sum of all numbers whose indices are multiples of is exactly (that is, the Möbius function value of ).
Now, to open this lock, he must know the number at position . Since he cannot do anything, he asks you for help.
Input Format
The first line contains an integer , indicating the number of test cases. The next lines each contain two integers .
Output Format
Output lines. Each line contains one integer, representing the value of the -th number. It can be proven that the answer is unique.
2
5 1
5 2
4
-1
Hint
.
.
$subtask3(45pts):~n\le 10^{18},~m\le 10^9,~\frac{n}{m}\le 10^9,~T\le 20$.
For all testdata, .
For sample 1, the sequence that satisfies the requirement is 4 -1 -1 0 -1.
Translated by ChatGPT 5
京公网安备 11011102002149号