随笔分类 - 数学-杜教筛
摘要:【题目链接】 http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1244 【题目大意】 计算莫比乌斯函数的区段和 【题解】 利用杜教筛: 求F(n)=∑(f(i)) 存在g=f*I,定义G(n)=∑(g(i)) 就可以得到F(
阅读全文
摘要:【题目链接】 https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1239 【题目大意】 计算欧拉函数的前缀和 【题解】 我们知道积性函数∑(phi(d))=n(d|n) 所以∑∑(miu(d))=n*(n+1)/2(d|i)
阅读全文
摘要:【题目链接】 https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1237 【题目大意】 求[1,n][1,n]最大公约数之和 【题解】 枚举最大公约数k,得到答案为2*∑(k*phi_sum(n/k))-n*(n+1)/2
阅读全文