TRENDGCD - Trending GCD
题意翻译
给出 n 和 m ,求:
$$
\sum_{i=1}^{n}\sum_{j=1}^{m} i\cdot j\cdot f(\gcd(i,j))
$$
其中:
$$
f(n) =\begin{cases}1,& n=1\\n,& n>1,\text{ n 不能被平方数整除}\\ 0,& n>1,\text{ n 能被平方数整除}\end{cases}
$$
简而言之:
$$f(n) =\mu^{2}(n)\cdot n$$
数据范围 $10^6$ ,多组询问。
题目描述
Problem statement is simple. Given **A** and **B** you need to calculate **S(A,B) .**
![sigma(a=1 to A)sigma(b=1 to B) (a*b*f(gcd(a,b)))](http://s29.postimg.org/qnxglb8mf/pic.png "TRENDGCD problem statement")
Here, **f(n)=n, if n is square free otherwise 0**. Also **f(1)=1**.
输入输出格式
输入格式
The first line contains one integer **T** - denoting the number of test cases.
**T** lines follow each containing two integers **A,B**.
输出格式
For each testcase output the value of S(A,B) mod 1000000007 in a single line.
输入输出样例
输入样例 #1
3
42 18
35 1
20 25
输出样例 #1
306395
630
128819