GCD XOR
1 B A N.
Here gcd(A; B) means the greatest common divisor of the numbers A and B. And A xor B is the
value of the bitwise xor operation on the binary representation of A and B.
Input
The rst line of the input contains an integer T (T 10000) denoting the number of test cases. The
following T lines contain an integer N (1 N 30000000).
For each test case, print the case number rst in the format, `Case X:' (here, X is the serial of the
input) followed by a space and then the answer for that case. There is no new-line between cases.
Explanation
Sample 1: For N = 7, there are four valid pairs: (3, 2), (5, 4), (6, 4) and (7, 6).
2
7
20000000
Sample Output
Case 1: 4
Case 2: 34866117
暴力,用因子更新,则由欧拉常数可知时间为O(nlogn)
如果采用正序枚举A,B 那么时间是n^2,这是不行的,注意时间估计,调和级数和欧拉常数,自己看
我枚举了1000以内的所有对,发现B没有奇数,B到底能否为奇数,谁给证明下或举个反例