inverse.modulo <- function(a, n){
GCD <- function(a, b){ n = a m = b
while(m != 0){
r <- n %% m
n <- m
m <- r
}
} while(n != 0){
} return(c(n, k)) }
Can you please help me with my code Thank you
inverse.modulo <- function(a, n){
GCD <- function(a, b){ n = a m = b
while(m != 0){
r <- n %% m
n <- m
m <- r
}
} while(n != 0){
} return(c(n, k)) }
Can you please help me with my code Thank you
Inverse Modulo <- function(a,n) {
int i=n,v=0,d=1;
while(a>0) {
t=i/a;
x=a;
a=i%x;
i=x;
x=d;
d=v-t*x;
v=x;
}
v%=n;
if(v<0) v+=n;
return v;
}
this code is written in C# but its contain just the basics of any coding language so i think you can convert it to the coding language you are using.