题目链接:https://www.luogu.com.cn/problem/P4464 简记$gcd(x,y)=(x,y)$. 推式子: $\sum_{i=1}^{n}{(i,n)^xlcm(i,n)^y}$ $=\sum_{i=1}^{n}{(i,n)^{x-y}(in)^y}$ $=n^y\sum_{d|n}d^{x-y}\sum_{i}i^y[(i,n)=d]$ $=n^y\sum_{d|n}{d^{x-y}\sum_{i=1}^{\frac{n}{d}}{(id)^y[(i,\frac{…