当前位置:网站首页>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 ;
边栏推荐
- 2022年劳务员-通用基础(劳务员)上岗证题目及答案
- Review of last week's hot spots (6.6-6.12)
- Brief introduction to memory structure of virtual machine
- Some experience in database table structure design
- Redis related
- Initial installation and use of redis [play with Huawei cloud]
- As a tester, these basic knowledge are essential
- 网传互联网公司加班表,排名第一的没有悬念!
- What is 400g Ethernet?
- Web3和NFT中的匿名性问题
猜你喜欢
Go 要加个箭头语法,这下更像 PHP 了!
Go zero microservice Practice Series (III. API definition and table structure design)
Brief request process
Idea remote debugging jar submitted by spark submit
网传互联网公司加班表,排名第一的没有悬念!
Advanced technology management - what management tools can managers use
Some experience in database table structure design
Understand an article: Spark operation mode
Talk about MySQL indexing mechanism
Redis相关
随机推荐
Use of servers
There is no suspense about the first one in the overtime table of the Internet company!
Codeforces Round #798 (Div. 2)ABCD
统计特殊子序列数目(0,1,2)DP
2021CCPC网络赛题解加总结
2022煤矿探放水特种作业证考试题库模拟考试平台操作
Brief request process
flutter简单优秀的开源dialog使用free_dialog
What is 400g Ethernet?
As a tester, these basic knowledge are essential
Database learning notes (Chapter 15)
日志1111
On the exploitation of a horizontal ultra vires vulnerability
Review of last week's hot spots (6.6-6.12)
音视频技术开发周刊 | 249
Software testing often asks, do you really build a testing environment?
Experience of electric competition - program-controlled wind pendulum
Initial installation and use of redis [play with Huawei cloud]
《气候韧性和可持续性》| 新研究表明超级飓风未来几年会对南亚产生更大破坏
ST表学习