Some Formulas.
待填。。
计数问题
在一个有\(n\)个点的完全图(complete graph)中有多少棵生成树
对每个\(n>0\),\({1,2,\cdots,n}\)上的完全图恰好有\(n^{n-2}\)棵生成树。
证明见《具体数学(第二版)》7.6 指数型生成函数。
**[Update] **这不就是Prufer序列的结论吗= =。
排列组合
1. 当 \(C_n^m\) 为奇数时,\((n\&m)==m\)
证明:因为是\(\mod 2\),所以考虑Lucas定理。
在\(\mod 2\)的情况下\(C(n,m)\)最后只会化成4种情况: \(C(0,1),C(0,0),C(1,0),C(1,1)\),后三种情况都是1,\(C(0,1)\)不存在(0),所以如果\(C(n,m)\mod 2\)为偶数,那么一定在Lucas的过程中出现了\(C(0,1)\)。
\(\mod 2\)的过程容易想到位运算。
由\(C(n,m)\mod 2=C(n\%2,m\%2)*C(n/2,m/2)=C(n\&1,m\&1)*C(n>>1,m>>1)\) 可知,若\(C(n,m)\)为奇数,那么\(m\)一定是\(n\)二进制1的子集。
2. $$\sum_{i=0}n\frac{1}{i!(n-i)!}=\frac{2n}{n!}$$
https://www.cnblogs.com/SovietPower/p/9425230 (这好像是某组合公式吧)
3. Catalan数应用扩展
https://blog.csdn.net/qq_33435265/article/details/68954205
4. 组合数的各种性质及定理
https://blog.csdn.net/litble/article/details/75913032
数论
1. 计算\(n!\)中质因子p的个数的公式(\(\varepsilon_{p}(n!)\))
\]
递归式为$$f(n)=f(\left\lfloor\frac{n}{p}\right\rfloor)+\left\lfloor\frac{n}{p}\right\rfloor$$
for(LL i=n; i; i/=p) k+=i/p;
应用:分解阶乘的质因数,如BZOJ1005、CF 1114C、扩展Lucas。
可由\(\varepsilon_2(n!)\)推广到任意素数\(p\)?即$$\varepsilon_p(n!)=\left\lfloor\frac{n}{p}\right\rfloor +\left\lfloor\frac{n}{p^2}\right\rfloor +\left\lfloor\frac{n}{p^3}\right\rfloor +\cdots=\sum_{k\geq1}\left\lfloor\frac{n}{p^k}\right\rfloor$$
\(\varepsilon_p(n!)\)有多大?从求和式中直接去掉底,然后对无穷几何级数求和,可以得到一个简单(然而很好的)上界:
\(\begin{aligned}\varepsilon_p(n!)&<\frac{n}{p}+\frac{n}{p^2}+\frac{n}{p^3}+\cdots\\&=\frac{n}{p}\left(1+\frac{1}{p}+\frac{1}{p^2}+\cdots\right)\\&=\frac{n}{p}\left(\frac{p}{p-1}\right)\\&=\frac{n}{p-1}\end{aligned}\)
——from 《具体数学(第二版)》
有兴趣的还可以看直尺函数(ruler function)。
2. 线性求阶乘逆元
因为\(((n-1)!)^{-1}=(n!)^{-1}*n\)。应用见排列组合2.
inv[n]=FP(fac[n],mod-2);
for(int i=n-1; ~i; --i) inv[i]=inv[i+1]*(i+1)%mod;
3. \(n\)为奇数时,\(\varphi(n)=\varphi(2n)\)。
Some Formulas.的更多相关文章
- たくさんの数式 / Many Formulas AtCoder - 2067 (枚举二进制)
Problem Statement You are given a string S consisting of digits between 1 and 9, inclusive. You can ...
- AtCoder Beginner Contest 045 C - たくさんの数式 / Many Formulas
Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem Statement You are given a string ...
- Codeforces 424 C. Magic Formulas
xor是满足交换律的,展开后发现仅仅要能高速求出 [1mod1....1modn],....,[nmod1...nmodn]的矩阵的xor即可了....然后找个规律 C. Magic Formulas ...
- CodeForce 424C Magic Formulas
这个题就是求出给的公式的结果. 仅仅要知道异或运算满足交换律跟结合律即可了.之后就是化简公式. #include<map> #include<string> #include& ...
- Many Formulas
You are given a string S consisting of digits between 1 and 9, inclusive. You can insert the letter ...
- codeforce-424C. Magic Formulas(数学)
C. Magic Formulas time limit per test:2 seconds memory limit per test:256 megabytes input stan ...
- Experimental Educational Round: VolBIT Formulas Blitz
cf的一次数学场... 递推 C 题意:长度<=n的数只含有7或8的个数 分析:每一位都有2种可能,累加不同长度的方案数就是总方案数 组合 G 题意:将5个苹果和3个梨放进n个不同的盒子里的方案 ...
- Codeforces Round #242 (Div. 2) C. Magic Formulas
解题思路是: Q=q1^q2.......^qn = p1^p2......^pn^((1%1)^....(1%n))^((2%1)^......(2%n))^.... 故Q的求解过程分成两部分 第一 ...
- Codeforces Round #242 (Div. 2) C. Magic Formulas (位异或性质 找规律)
题目 比赛的时候找出规律了,但是找的有点慢了,写代码的时候出了问题,也没交对,还掉分了.... 还是先总结一下位移或的性质吧: 1. 交换律 a ^ b = b ^ a 2. 结合律 (a^b) ^ ...
- Npoi 导出Excel 下拉列表异常: String literals in formulas can't be bigger than 255 Chars ASCII
代码: public static void dropDownList(string[] datas, string filePath) { HSSFWorkbook workbook = new H ...
随机推荐
- MFC_CFileDialog_选择单一文件
场景 选择单一文件 技术点 CFileDialog CFileDialog::CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, ...
- Difference between plt.draw() and plt.show() in matplotlib
Difference between plt.draw() and plt.show() in matplotlib down voteaccepted plt.show() will display ...
- UML和模式应用5:细化阶段(10)---UML交互图
1.前言 UML使用交互图来描述对象间消息的交互 交互图可以用于动态对象建模. 交互图有两种类型:顺序图和通信图. UML交互图将用来解释和阐述对象设计. 2.顺序图和通信图 顺序图具有丰富的符号标记 ...
- 使用neo4j-import工具导入数据
从Neo4j2.2版本开始,系统就自带了一个大数据量的导入工具:neo4j-import,可支持并行.可扩展的大规模csv数据导入(本例版本为:3.4.7版本) 1.前提条件 关闭neo4j 无法在原 ...
- Raw Socket vs Stream Socket vs datagram socket,原始套接字与流式套接字与数据报套接字
https://opensourceforu.com/2015/03/a-guide-to-using-raw-sockets/ In this tutorial, lets take a look ...
- TCP/IP指纹鉴别 fingerprint
http://www.freebuf.com/articles/system/30037.html使用TCP/IP协议栈指纹进行远程操作系统辨识 Fyodor <fyodor@insecure. ...
- centos6.5环境通达OA数据库mysql5.0.67升级至mysql5.5.48方案
centos6.5环境通达OA数据库mysql5.0.67升级至mysql5.5.42方案 整体方案: 环境准备,在备用服务器安装mysql5.5数据库 1.停用生产环境的应用访问 直接修改web的访 ...
- iOS 中的Certificate,Provisioning Profile 的一些注意 (不断完善中)
注册apple id 有1年多了,这些概念还是模模糊糊的,决定在这里总结一下. 请参阅官方文档 App Distribution Guide code singing的作用如下: Code signi ...
- Linux查看文件命令
linux查看日志文件内容命令有 cat 由第一行开始显示文件内容 tac 从最后一行开始显示,可以看出 tac 是 cat 的倒着写 nl 显示的时候,顺道输出行号! more 一页一页的显示文件内 ...
- java 数据的存储
1. 寄存器. 这是最快的存储区,因为它位于不同于其他存储区的地方 -- 处理器的内部.但是寄存器的数量极其有限,所以寄存器根据需求进行分配.你不能直接控制,也不能在程序中感觉到寄存器存在的任何迹象. ...