Description 定义 \[ f_k(n)=\sum_{\substack{1\leq i\leq n\\gcd(i,n)=1}}i^k \] 给出\(n=\prod_{i=1}^w p_i^{a_i}\),求\(f_k(n)\).\(1\leq w\leq 1000, 1\leq q_i,a_i\leq 10^9\).保证\(p_i\)都为质数且互不相同. Solution 令\(g_k(n)=\sum_{i=1}^ni^k\),则 \[ \begin{aligned} g_k(n)&=…