题意
做法
设(g(n)=n^2-3n+2),有(g(n)=sumlimits_{d|n}f(d)),反演一下有(f(n)=sumlimits_{d|n}mu(frac{n}{d})g(d))
故$$ans=sumlimits_{i=1}^n sumlimits_{d|i}mu(frac{n}{d})g(d)=sumlimits_{i=1}^n g(i)sumlimits_{j=1}^{frac{n}{i}}mu(j)$$
然后杜教筛一下(mu)
还有种更巧妙的方法
设(g(n)=sumlimits_{i=1}^n f(i))
有
[sumlimits_{i=1}^n g(frac{n}{i})=sumlimits_{i=1}^nsumlimits_{j=1}^{frac{n}{i}}f(j)=sumlimits_{i=1}^n frac{n}{i}=sumlimits_{i=1}^n sumlimits_{d|i}f(d)=sumlimits_{i=1}^n i^2-3i+2
]
故
[g(n)=(sumlimits_{i=1}^n i^2-3i+2)-sumlimits_{i=2}^{n}g(frac{n}{i})
]