Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Modular-inverse/BASIC256/modular-inverse.basic
Normal file
19
Task/Modular-inverse/BASIC256/modular-inverse.basic
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
print multInv(42, 2017)
|
||||
end
|
||||
|
||||
function multInv(a,b)
|
||||
x0 = 0
|
||||
b0 = b
|
||||
multInv = 1
|
||||
if b = 1 then return
|
||||
while a > 1
|
||||
q = a / b
|
||||
t = b
|
||||
b = a mod b
|
||||
a = t
|
||||
t = x0
|
||||
x0 = multInv - q * x0
|
||||
multInv = int(t)
|
||||
end while
|
||||
if multInv < 0 then return multInv + b0
|
||||
end function
|
||||
Loading…
Add table
Add a link
Reference in a new issue