一个菜鸡对数论的一点点理解... 莫比乌斯函数 定义函数$\mu(n)$为: 1. 当n有平方因子时,$\mu(n)=0$。 2. 当n没有平方因子时,$\mu(n)=( 1)^{\omega(n)}$,$\omega(n)$表示n不同质因子的个数。 性质1: $\sum_{d|n}\mu(d)=[ ...
分类:
其他好文 时间:
2019-01-23 12:32:03
阅读次数:
245
"link" 给定N, M,求1 include using namespace std; const int fuck = 10000000; int prime[10000010], tot; bool vis[10000010]; int mu[10000010], sum[10000010] ...
分类:
其他好文 时间:
2019-01-20 20:12:40
阅读次数:
176
"link" 给定整数N,求1 include using namespace std; const int fuck = 10000000; int prime[10000010], tot; bool vis[10000010]; int mu[10000010], sum[10000010]; ...
分类:
其他好文 时间:
2019-01-20 20:06:53
阅读次数:
250
最近在做数论题,积累一些式子。 $[x=1]=\sum_{d|x}\mu(d)$(莫比乌斯函数定义) 然后才推出莫比乌斯函数的公式以及莫比乌斯函数是积性函数。 $\sum_{i=1}^n[\gcd(i,n)=1]=\varphi(n)$(欧拉函数定义) 根据一些计数原理,能推出来欧拉函数的公式,从而 ...
分类:
其他好文 时间:
2019-01-20 12:06:02
阅读次数:
194
待学习 https://www.cnblogs.com/peng ym/p/8647856.html 莫比乌斯反演 https://www.cnblogs.com/cjyyb/p/9495131.html 博弈论 https://www.cnblogs.com/weeping/p/6847112.h ...
分类:
编程语言 时间:
2019-01-18 23:59:49
阅读次数:
308
"传送门" 简化题意:给出一棵$n$个点的树,编号为$1$到$n$,第$i$个点的点权为$a_i$,保证序列$a_i$是一个$1$到$n$的排列,求 $$ \frac{1}{n(n 1)} \sum\limits_{i=1}^n \sum\limits_{j=1}^n \varphi(a_ia_j) ...
分类:
其他好文 时间:
2019-01-17 21:20:29
阅读次数:
181
莫比乌斯反演 设数论函数 $F(x)$, $f(x)$, 若$F(n)=\sum_{d|n}f(d)$, 则有 $$ f(n)=\sum_{d|n}\mu(d)F(\frac{n}{d}) $$ 若$F(n)=\sum_{n|d}f(d)$ $$f(n)=\sum_{n|d}\mu(\frac{d} ...
分类:
其他好文 时间:
2019-01-15 17:07:05
阅读次数:
166
C - Visible Trees HDU - 2841 思路 :被挡住的那些点(x , y)肯定是 x 与 y不互质。能够由其他坐标的倍数表示,所以就转化成了求那些点 x,y互质 也就是在 1 - m 1 - n 中找互质的对数,容斥 求一下即可 #include<bits/stdc++.h> u ...
分类:
其他好文 时间:
2019-01-13 02:02:59
阅读次数:
220
D - GCD HDU - 1695 思路: 都 除以 k 后转化为 1-b/k 1-d/k中找互质的对数,但是需要去重一下 (x,y) (y,x) 这种情况。 这种情况出现 x ,y 肯定 都在 min (b/k, d/k) ,所以 奇数 最后 减去 一半 即可。 #include<bits/st ...
分类:
其他好文 时间:
2019-01-13 01:53:34
阅读次数:
217