【HDU2019多校】Easy Math Problem (插值+Min25+杜教筛)

Problem Description

One day, Touma Kazusa encountered a easy math problem. Given n and k, she need to calculate the following sum modulo 1e9+7.
∑ni=1∑nj=1gcd(i,j)klcm(i,j)[gcd(i,j)∈prime]%(1e9+7) ∑_{i=1}^n∑_{j=1}^ngcd(i,j)^klcm(i,j)[gcd(i,j)∈prime]\%(1e9+7)∑
i=1
n


j=1
n

gcd(i,j)
k
lcm(i,j)[gcd(i,j)∈prime]%(1e9+7)

However, as a poor student, Kazusa obviously did not, so Touma Kazusa went to ask Kitahara Haruki. But Kitahara Haruki is too busy, in order to prove that he is a skilled man, so he threw this problem to you. Can you answer this easy math problem quickly?

Input

There are multiple test cases.(T=5) The first line of the input contains an integer T, indicating the number of test cases. For each test case:

There are only two positive integers n and k which are separated by spaces.

1≤n≤1010 1≤n≤10^{10}1≤n≤10
10

1≤k≤100 1≤k≤1001≤k≤100

Output

An integer representing your answer.

Sample Input

1

10 2
Sample Output

2829

SOLUTION:

https://blog.csdn.net/baiyifeifei/article/details/97798086

代码:https://blog.csdn.net/Coldfresh/article/details/98668028

其实官方题解写的也不错

这题要是能写出来那数论算是毕业了吧qwq

 

猜你喜欢

转载自www.cnblogs.com/zhangbuang/p/11344501.html