当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7080:Pty hates prime numbers

题目描述
Pty thinks prime numbers are extremely annoying numbers. Specifically, he hates the first k prime numbers.

As ”Hate me Hate my dog.” , if one prime factor of the integer x is what Pty hates, Pty will also hate x.

Now Pty wants to know how many integers in [1,n] he dosen’t hate.

Formally, Pty wants to know $\sum_{x=1}^n$[$\forall$$i$$\in$$[1,k],p[i]$$\nmid$$x$] (p[i] means the $i^{th}$ prime number) .
输入解释
The first line contains a single integer T(1 ≤ T ≤ 100000) — the number of test cases

The only line of each test case contains two integers n,k(1 ≤ n ≤ $10^{18}$,1 ≤ k ≤ 16).
输出解释
For each test case, output the number of integers Pty doesn’t hate.
输入样例
5
10 1
20 2
30 3
40 4
50 5

输出样例
5
7
8
9
11

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7080

最后修改于 2021-10-23T19:11:20+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 524288/524288K(Java/Others)