当前位置:网站首页>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 ;
边栏推荐
- What is 400g Ethernet?
- Database learning notes (Chapter 15)
- 什么是400G以太网?
- Actual combat simulation │ real time error alarm of enterprise wechat robot
- ue5 小知识点 random point in Bounding Boxf From Stream
- 《自然-通讯》| 用机器学习和时间序列数据为气候变化下的武装冲突风险建模
- 判定二分图和二分图最大匹配
- Web3 系统构建:去中心化的原则、模型和方法(上)
- Codeforces Round #798 (Div. 2)ABCD
- Redis相关
猜你喜欢
区间修改乘和加(理解懒标记的好例题)
容斥原理(能被整除的数)
Brief introduction to memory structure of virtual machine
There is no suspense about the first one in the overtime table of the Internet company!
服务器的使用
音视频技术开发周刊 | 249
Multithreading starts from the lockless queue of UE4 (thread safe)
元宇宙土地:是什么让数字房地产变得有价值
Understand an article: Spark operation mode
什么是400G以太网?
随机推荐
2022年劳务员-通用基础(劳务员)上岗证题目及答案
Introduction to binary tree
第六章 I/O管理作业
Codeforces Round #798 (Div. 2)ABCD
Pagoda access changed from IP to domain name
Necessary for Architects: system capacity status checklist
宝塔中navicat连接mysql
Determine the maximum match between bipartite graph and bipartite graph
Install Kubernetes 1.24
Pytorch basis (II) -- tensor and gradient
About instruction set bits and instruction architecture bits
Navicat connection MySQL in Pagoda
How to optimize MySQL?
2020 ICPC Asia Taiwan Online Programming Contest C Circles
ue5 小知识点 random point in Bounding Boxf From Stream
服务器的使用
Multithreading starts from the lockless queue of UE4 (thread safe)
d求值两次map
Review of last week's hot spots (6.6-6.12)
网传互联网公司加班表,排名第一的没有悬念!