Soldier and Number Game-素数筛
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.
Examples
2
3 1
6 3
2
5
最新文章
- AD域撤销域用户管理员权限方案
- Android消息队列和Looper
- spring刚开始学习搭建
- gethostbyname 亲测可用
- CodeForces - 405A
- 如何扩大ImageView的点击区域
- java 多线程1
- ZBar之自定义二维码扫描
- 如何使用 Docker 部署一个基于 Play Framework 的 Scala Web 应用?
- 成功的GIT开发分支模型和策略
- Android 从java字节码告诉你 为什么Handler会造成内存泄露
- 为apache单独编译mod_rewrite.so
- SQL 远程过程调用失败【0x800706be】或正在关闭 【0x80041033】解决方法
- fstab设置开机挂载--鸟哥[阅读]
- 如何生成CA证书
- Quick-Cocos2d-X 捋一捋框架流程
- PhotoPickerNewDemo【PhotoPicker0.9.12的个性化修改以及使用(内部glide版本号是4.1.1)】
- Ubuntu下安装chrome浏览器
- tensorflow学习之(十一)将python代码写入文件
- Linux搭建SVN环境