Codeforces Round 304 (Div. 2)
D
Soldier and Number Game
Codeforces
1700
原题
← CE →
翻译中…

Two soldiers are playing a game. At the beginning first of them chooses a positive integer $*n*$ and gives it to the second soldier. Then the second one tries to make maximum possible number of rounds. Each round consists of choosing a positive integer $*x* > 1$, such that $*n*$ is divisible by $*x*$ and replacing $*n*$ with $*n* / *x*$. When $*n*$ becomes equal to $1$ and there is no more possible valid moves the game is over and the score of the second soldier is equal to the number of rounds he performed.

翻译中…

To make the game more interesting, first soldier chooses $*n*$ of form $*a*! / *b*!$ for some positive integer $*a*$ and $*b*$ ($*a* ≥ *b*$). Here by $*k*!$ we denote the factorial of $*k*$ that is defined as a product of all positive integers not large than $*k*$.

翻译中…

What is the maximum possible score of the second soldier?

翻译中…

Input

翻译中…

First line of input consists of single integer $*t*$ ($1 ≤ *t* ≤ 1 000 000$) denoting number of games soldiers play.

翻译中…

Then follow $*t*$ lines, each contains pair of integers $*a*$ and $*b*$ ($1 ≤ *b* ≤ *a* ≤ 5 000 000$) defining the value of $*n*$ for a game.

翻译中…

Output

翻译中…

For each game output a maximum score that the second soldier can get.

翻译中…

样例

Input #1
2
3 1
6 3
Output #1
2
5
InputCopy OutputCopy
题目信息
题号
546D
时间限制
3 s
内存限制
256 MB
标签
构造
动态规划
数学
数论

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