AtCoder Beginner Contest 162
翻译中…
Problem Statement
翻译中…
Consider sequences $\{A_1,...,A_N\}$ of length $N$ consisting of integers between $1$ and $K$ (inclusive).
翻译中…
There are $K^N$ such sequences. Find the sum of $\gcd(A_1, ..., A_N)$ over all of them.
翻译中…
Since this sum can be enormous, print the value modulo $(10^9+7)$.
翻译中…
Here $\gcd(A_1, ..., A_N)$ denotes the greatest common divisor of $A_1, ..., A_N$.
翻译中…
Constraints
翻译中…
$2 \leq N \leq 10^5$$1 \leq K \leq 10^5$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N K
翻译中…
Output
翻译中…
Print the sum of $\gcd(A_1, ..., A_N)$ over all $K^N$ sequences, modulo $(10^9+7)$.
翻译中…
样例
Input #1
3 2
Output #1
9
$\gcd(1,1,1)+\gcd(1,1,2)+\gcd(1,2,1)+\gcd(1,2,2)$ $+\gcd(2,1,1)+\gcd(2,1,2)+\gcd(2,2,1)+\gcd(2,2,2)$ $=1+1+1+1+1+1+1+2=9$
Thus, the answer is $9$.
Input #2
3 200
Output #2
10813692
Input #3
100000 100000
Output #3
742202979
Be sure to print the sum modulo $(10^9+7)$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。