《Algorithms》第1章:Algorithm with numbers 学习笔记
来源:互联网 发布:淘宝可以买发票吗 编辑:程序博客网 时间:2024/05/16 01:28
1、二进制乘法的两个算法:
这两个算法本质上是一样的。讲到分治的时候,还会介绍新的算法。
2、乘法运算、指数模运算、欧几里得最大公约数:
3、欧几里得算法的几个引理:
- if a >= b, then a mod b < a/2
- if d divides both a and b, and d = ax + by for some integers x and y(may be negative) , then necessarily d = gcd(a,b)
4、模除法:gcd(a,N) = 1(即互质) <==> 存在x,使得ax ≡ 1 (mod N) (可用反证法证明)
5、素性测试:
- 最naive的想法:用 2到根号n 除n
- 费马小定理,通过费马测试的数不一定都是素数;
引理:如果存在一个相对N为素数的a使得 a^(N-1) ≠ 1 mod(N), 则小于N的所有数里面至少有一半(N/2)个 满足这种条件的数。
根据引理:P(return yes when N is not prime) ≤ 1/2
所以只需在选取k个a,就可以使出错概率减小到1/ (2^k) (以上分析都不考虑Carmichael number)
以下是伪码:
附:当a = 2, n≤25*10^9时,费马素性测试的出错情况:(出错概率随着要测试的数的长度的增加而快速下降)
6、密码学原理:对发出的信息进行扰乱,使人读不懂其内容,而接收信息的人按照事先约定的某种方式讲扰乱的信息进行复原,然后即可读懂。分为 私匙协议 和 公匙协议(数论) 。
- 《Algorithms》第1章:Algorithm with numbers 学习笔记
- 《Algorithms》第2章:Divide-and-conquer algorithms 学习笔记
- 《Algorithms》第5章:Greedy Algorithms 学习笔记
- 《Algorithms》第0章:Prologue 学习笔记
- 【学习笔记】Algorithmes with numbers(1)
- 《Algorithms》第3章:Decompositions of graphs 学习笔记
- 《Algorithms》第4章:Paths in graphs 学习笔记
- 《Algorithms》第6章:Dynamic Programming 学习笔记
- 《Algorithms》第7章:Linear programming and reductions 学习笔记
- 《Algorithms》第8章:NP完全问题 学习笔记
- Introduction to Algorithms 算法导论 第1章 基础知识 学习笔记及习题解答
- Introduction to Algorithms 算法导论 第2章 算法入门 学习笔记及习题解答
- Introduction to Algorithms 算法导论 第3章 函数的增长 学习笔记及习题解答
- Introduction to Algorithms 算法导论 第4章 递归式 学习笔记及习题解答
- Algorithms 学习笔记02 Analysis Of Algorithms
- LeetCode-algorithms 357. Count Numbers with Unique Digits
- Starting with Algorithms(Part 1)
- Algorithm学习笔记 --- 3n+1问题
- 获取iPhone屏幕的大小
- iReport学习笔记
- Spring入门Blog[十四、Spring中hibernateTemplate的使用]
- Linux设备驱动之I2C架构分析
- 程序员出入在那里
- 《Algorithms》第1章:Algorithm with numbers 学习笔记
- 查找目录下的所有文件中是否含有某个字符串
- shell脚本查找两个文件夹下相同的文件名
- 编写函数,找到位向量最左边的1,将其后所有位置0
- Jquery刷新页面
- JAVA设计模式十九--Facade(外观模式)
- 创业公司获得种子投资之后该明白的7件事
- Android平台中振动器系统详解
- Concurrent FND scripts & Related Common SQL Decodes