Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
18
Task/Modular-inverse/Ring/modular-inverse.ring
Normal file
18
Task/Modular-inverse/Ring/modular-inverse.ring
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
see "42 %! 2017 = " + multInv(42, 2017) + nl
|
||||
|
||||
func multInv a,b
|
||||
b0 = b
|
||||
x0 = 0
|
||||
multInv = 1
|
||||
if b = 1 return 0 ok
|
||||
while a > 1
|
||||
q = floor(a / b)
|
||||
t = b
|
||||
b = a % b
|
||||
a = t
|
||||
t = x0
|
||||
x0 = multInv - q * x0
|
||||
multInv = t
|
||||
end
|
||||
if multInv < 0 multInv = multInv + b0 ok
|
||||
return multInv
|
||||
Loading…
Add table
Add a link
Reference in a new issue