#P6156. Sum of GCD-Power Series with Squarefree Filter
Sum of GCD-Power Series with Squarefree Filter
Sum of GCD-Power Series with Squarefree Filter
You are given two integers n and k. Compute the following sum modulo 998244353:
\[ S = \sum_{i=1}^{n}\sum_{j=1}^{n} (i+j)^k\, f(\gcd(i,j))\, \gcd(i,j), \] where \(\gcd(i,j)\) denotes the greatest common divisor of \(i\) and \(j\).
The function \(f\) is defined as follows:
- If the argument has a square factor (i.e. there exists an integer \(k > 1\) such that \(k^2\) divides the number), then \(f(\text{number}) = 0\).
- Otherwise, \(f(\text{number}) = 1\).
In other words, for any positive integer \(m\), \(f(m)=0\) if \(m\) is not squarefree, and otherwise \(f(m)=1\).
Output the sum \(S\) modulo \(998244353\).
inputFormat
The input consists of a single line with two integers n and k (1 ≤ n and k ≥ 0).
outputFormat
Output a single integer: the value of \(S\) modulo \(998244353\).
sample
2 1
16