Given an integer N,how can I find how many pairs $(A, B)$ are there such that: gcd $(A, B) = $A$ \oplus B$ where $ 1 ≤ B ≤ A ≤ N $.
Here gcd $(A, B)$ means the greatest common divisor of the numbers A and B. And $A \oplus B$ is the value of the bitwise $\oplus $ operation on the binary representation of A and B.
For example , if I have been given the value of N is $20000000$ , then the answer is $34866117 $ . I am trying to solve this problem by experimenting with small values of N .