Codeforces Round 949 (Div. 2)
A
Turtle and Piggy Are Playing a Game
Codeforces
800
原题
←B →
翻译中…

Turtle and Piggy are playing a number game.

翻译中…

First, Turtle will choose an integer $x$, such that $l \le x \le r$, where $l, r$ are given. It's also guaranteed that $2l \le r$.

翻译中…

Then, Piggy will keep doing the following operation until $x$ becomes $1$:

翻译中…
  • Choose an integer $p$ such that $p \ge 2$ and $p \mid x$ (i.e. $x$ is a multiple of $p$).
  • Set $x$ to $\frac{x}{p}$, and the score will increase by $1$.
翻译中…

The score is initially $0$. Both Turtle and Piggy want to maximize the score. Please help them to calculate the maximum score.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The first line of each test case contains two integers $l, r$ ($1 \le l \le r \le 10^9, 2l \le r$) — The range where Turtle can choose the integer from.

翻译中…

Output

翻译中…

For each test case, output a single integer — the maximum score.

翻译中…

Note

翻译中…

In the first test case, Turtle can choose an integer $x$, such that $2 \le x \le 4$. He can choose $x = 4$. Then Piggy can choose $p = 2$ for $2$ times. After that, $x$ will become $1$, and the score will be $2$, which is maximized.

翻译中…

In the second test case, Turtle can choose an integer $3 \le x \le 6$. He can choose $x = 6$. Then Piggy can choose $p = 2$, then choose $p = 3$. After that, $x$ will become $1$, and the score will be $2$, which is maximum.

翻译中…

In the third test case, Turtle can choose $x = 12$.

翻译中…

In the fourth test case, Turtle can choose $x = 16$.

翻译中…

样例

Input #1
5
2 4
3 6
2 15
6 22
114514 1919810
Output #1
2
2
3
4
20
InputCopy OutputCopy
题目信息
题号
1981A
时间限制
1 s
内存限制
256 MB
标签
暴力
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。