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
1
Task/Modular-inverse/Sidef/modular-inverse-1.sidef
Normal file
1
Task/Modular-inverse/Sidef/modular-inverse-1.sidef
Normal file
|
|
@ -0,0 +1 @@
|
|||
say 42.modinv(2017)
|
||||
13
Task/Modular-inverse/Sidef/modular-inverse-2.sidef
Normal file
13
Task/Modular-inverse/Sidef/modular-inverse-2.sidef
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
func invmod(a, n) {
|
||||
var (t, nt, r, nr) = (0, 1, n, a % n)
|
||||
while (nr != 0) {
|
||||
var quot = int((r - (r % nr)) / nr);
|
||||
(nt, t) = (t - quot*nt, nt);
|
||||
(nr, r) = (r - quot*nr, nr);
|
||||
}
|
||||
r > 1 && return()
|
||||
t < 0 && (t += n)
|
||||
t
|
||||
}
|
||||
|
||||
say invmod(42, 2017)
|
||||
Loading…
Add table
Add a link
Reference in a new issue