Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Modular-inverse/11l/modular-inverse.11l
Normal file
15
Task/Modular-inverse/11l/modular-inverse.11l
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
F mul_inv(=a, =b)
|
||||
V b0 = b
|
||||
V x0 = 0
|
||||
V x1 = 1
|
||||
I b == 1 {R 1}
|
||||
|
||||
L a > 1
|
||||
V q = a I/ b
|
||||
(a, b) = (b, a % b)
|
||||
(x0, x1) = (x1 - q * x0, x0)
|
||||
|
||||
I x1 < 0 {x1 += b0}
|
||||
R x1
|
||||
|
||||
print(mul_inv(42, 2017))
|
||||
Loading…
Add table
Add a link
Reference in a new issue