In mathematics, the function d(n) denotes the number of divisors of positive integer n.
For example, d(12)=6 because 1,2,3,4,6,12 are all 12’s divisors.
In this problem, given l,r and k, your task is to calculate the following thing :
(∑i=lrd(ik))mod998244353
Input
The first line of the input contains an integer T(1≤T≤15), denoting the number of test cases.
In each test case, there are 3 integers l,r,k(1≤l≤r≤1012,r−l≤106,1≤k≤107)
.
Output
For each test case, print a single line containing an integer, denoting the answer.
Sample Input
3
1 5 1
1 10 2
1 100 3
Sample Output
10
48
2302
题意:
就如同那个公式写的,求质因子个数.
思路:
看到题目说质因子个数,我们就应该想到唯一分解定理. 我们知道数 n 的 唯一分解形式为: n = p1e1 * p2e2 … pnen, 那么nk 呢,自己分析几个例子可以看出 nk 实践上就是 n 的分解形式的 k 次方,于是我们只需要把指数变成这样: nk = p1e1k * p2e2k … pnenk 那么接下来我们就应该考虑怎么样分解,如果我们暴力枚举的话肯定是会超时的,因为区间中有很大素数,会拖慢我们的效率,于是我们想,能不能避免素数,然后我们想到类似素数筛法的原理,我们从2 到$\sqrt r $ 枚举每一个素数 p ,然后我们在 l 到 r 的范围内处理每一个之前枚举的这个素数的倍数 x , 看 每个 x 包含多少个p.最后剩下的没有被处理的就是质数.