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

建议使用的浏览器:

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

7201:Yet Another Easy Function Sum Problem

题目描述
Two years ago, Silver187 learned Mobius inversion and knew how to calculate ($1\le n\le 10^9$)
$$
\sum_{i=1}^n \sum_{j=1}^n \gcd(i,j)
$$
One year ago, Silver187 learned how to calculate ($1\le n\le 10^5$)
$$
\sum_{i=1}^n \sum_{j=1}^n \varphi(ij)
$$
But he tried to solve this problem when $1\le n\le 10^9$. Finally, he failed to solve it. But he didn't completely fail, he solved a similar problem:

Silver187 defines that if $n=\prod_{i=1}^k p_i^{\alpha_i}(p_i\in \operatorname{prime} ,\alpha_i\gt0, \forall i \ne j, p_i \ne p_j)$ , then $H(n)=\prod_{i= 1}^k p_i$. In particular, $H(1)=1$.

Silver187 likes gcd, so he wants to ask you to calculate the result of the following formula.
$$
(\sum_{i=1}^n \sum_{j=1}^n H(ij)[\gcd(i,j)=1])\bmod 10^9+7
$$
Now, Silver187 asks you to solve this problem.
输入解释
First line has one integer $T(1≤T≤5)$, indicating there are $T$ test cases. In each case:

Only one line contains an integer $n(1\le n\le 10^9)$.

Input guarantee $\sum n\le 2\times 10^9$.
输出解释
In each case, output an integer on a line.
输入样例
5
3
5
1000
10000
1000000
输出样例
23
119
181591410
452132610
74649566

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

源链接: HDU-7201

最后修改于 2022-09-15T06:17:19+00:00 由爬虫自动更新

共提交 0

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