September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
5
Task/Modular-inverse/Zkl/modular-inverse.zkl
Normal file
5
Task/Modular-inverse/Zkl/modular-inverse.zkl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
fcn gcdExt(a,b){
|
||||
if(b==0) return(1,0,a);
|
||||
q,r:=a.divr(b); s,t,g:=gcdExt(b,r); return(t,s-q*t,g);
|
||||
}
|
||||
fcn modInv(a,m){i,_,g:=gcdExt(a,m); if(g==1) {if(i<0)i+m} else Void}
|
||||
Loading…
Add table
Add a link
Reference in a new issue