当前位置:网站首页>Multiplicative inverse action
Multiplicative inverse action
2022-06-13 11:02:00 【I can screw the bottle cap when I am born again】
First, let's talk about the inverse element :
Inverse element
Number theory reciprocal , It is also called inverse element
The reciprocal in number theory has a special meaning
Do you think a The reciprocal of is still in number theory 1/a Do you
(・∀・) Hem ~ naive
Let's first introduce the concept of remainder
(a + b) % p = (a%p + b%p) %p ( Yes )
(a - b) % p = (a%p - b%p) %p ( Yes )
(a * b) % p = (a%p * b%p) %p ( Yes )
(a / b) % p = (a%p / b%p) %p ( wrong )
Why division is wrong
It's hard to prove right , To prove wrong, just give a counterexample
(100/50)%20 = 2 ≠ (100%20) / (50%20) %20 = 0
For some topics , We must find the remainder in the middle process , Otherwise, the number is too large , The computer can't save , So if there's division in this equation , Are we unable to calculate this formula ?
The answer, of course, is NO (>o<)
Then you need the inverse element
We know
If
a*x = 1
that x yes a Reciprocal ,x = 1/a
however a If not 1, that x It's a decimal
In number theory , In most cases, there is a surplus , So now the problem has changed
a*x = 1 (mod p)
that x It must be equal to 1/a Do you
not always
So at this point , We will take x as a Reciprocal , Just add a remainder condition , therefore x be called a About p Inverse element
such as 2 * 3 % 5 = 1, that 3 Namely 2 About 5 Inverse element , Or say 2 and 3 About 5 It's the opposite of each other
In summary
set up c yes b Inverse element , Then there are b*c≡1(mod m);
inference :(a/b)mod m = (a/b)1mod m = (a/b)bc mod
m=ac(mod m); namely a/b The modulus of is equal to a * (b Inverse element ) The mold ;
This corollary explains why the inverse element is introduced ;
Function of inverse element
A word is , Change division to multiplication ;
for example seek (A / B) %p ; stay B When the value of is very large ,B As divisor , It is very likely that the precision will explode ; The divisor cannot be too large ; So we can turn it into multiplication to solve ;
(a/b)mod m = (a/b)*1mod m = (a/b)bc mod
m=ac(mod m);
namely a/b The modulus of is equal to a * (b Inverse element ) The mold ;
So the steps of finding this formula according to this inference are clear ;
Find out B Inverse element ( Extended Euclid , Fermat lemma + Fast power ) Can find ;
Just quote formula inference and apply it ;
边栏推荐
- Determine the maximum match between bipartite graph and bipartite graph
- 作为一个测试人员,这些基础知识必不可少
- Go zero microservice Practice Series (III. API definition and table structure design)
- 2020 ICPC Asia Taiwan Online Programming Contest C Circles
- ue5 小知识点 geometry script modeling
- View the default MySQL password in the pagoda
- Actual combat simulation │ real time error alarm of enterprise wechat robot
- Questions and answers of the labor worker general basic (labor worker) work license in 2022
- spark源码(一)spark-submit如何将jar以及配置参数提交给spark服务器
- 21世纪以来的历次“粮食危机”,发生了什么?
猜你喜欢

Actual combat analysis of malicious code lab05-01

Experience of electric competition - program-controlled wind pendulum

Codeforces Round #798 (Div. 2)ABCD

Electrolytic capacitor, tantalum capacitor, ordinary capacitor

Codeforces Round #798 (Div. 2)ABCD

Brief introduction to memory structure of virtual machine

电赛校赛经验-程控风力摆

Go zero microservice Practice Series (III. API definition and table structure design)

The first laravel workflow engine released the official version of v1.0

Web3和NFT中的匿名性问题
随机推荐
数据库学习笔记(第十五章)
Questions and answers of the labor worker general basic (labor worker) work license in 2022
SSM integration preliminary details
Big O notation interpretation
《气候韧性和可持续性》| 新研究表明超级飓风未来几年会对南亚产生更大破坏
Web 3.0?高成本版的P2P而已
Web3和NFT中的匿名性问题
Easyclick run code snippet out null
[cloud enjoying freshness] community weekly · vol.66- Huawei partners and Developers Conference 2022 wonderful agenda announcement
数位DP例题
Understand an article: Spark operation mode
Web3 系统构建:去中心化的原则、模型和方法(上)
Test cases that testers must master
判定二分图和二分图最大匹配
基于Vue+Nest.js+MySQL的跨平台开源社区运营管理系统
乘法逆元作用
To vent their dissatisfaction with their superiors, Baidu post-95 programmers were sentenced to 9 months for deleting the database
Determine the maximum match between bipartite graph and bipartite graph
Go 要加个箭头语法,这下更像 PHP 了!
Environ. Sci. Technol. (if=9.028) | impact of urban greening on atmospheric environment