| TheForces Round #31 (Div2.9-Forces) |
|---|
| Finished |
Alice and Bob play a game on two positive integers $$$x$$$ and $$$y$$$. They take turns alternatively, with Alice making the first move. In a move, a player can subtract a multiple of one number from the other number. After the operation, both should remain non-negative. The first person to make the value of $$$x \cdot y$$$ equal to $$$0$$$ wins.
An example of the game on $$$x = 4$$$, $$$y = 14$$$:
Given two positive integers $$$l$$$ and $$$r\ (l \le r)$$$. Your task is to find the number of ordered pairs $$$(x,y)$$$ such that $$$l \le x \le y \le r$$$ and Alice wins for these pairs.
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^5$$$).
For each test case, the only line contains two space-separated integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$).
For each test case output a single number in a new line — the number of ordered pairs for which Alice will win.
41 34 566 9991 1000000
5 2 247645 309017803391
In the first test case, the ordered pairs for which Alice will win are $$$(1,1),(1,2),(1,3),(2,2)$$$ and $$$(3,3)$$$.
In the second test case, the ordered pairs for which Alice will win are $$$(4,4)$$$ and $$$(5,5)$$$.
| Name |
|---|


