pub fn modulo_inverse(num: i32, modulus: i32) -> i32{
    if (modulus < 2) | (num % modulus == 0){
	    return 0;
	}
    let mut first_num = modulus;
	let mut second_num = num % modulus;
	let mut remainder;
	let mut quotient;
	let mut first_inverse = 0;
	let mut second_inverse = 1;
	remainder = first_num % second_num;
	quotient = first_num / second_num;
	while remainder != 0{
	    first_num = second_num;
        second_num = remainder;
		let temp = first_inverse - quotient*second_inverse;
		first_inverse = second_inverse;
        second_inverse = temp;
		remainder = first_num % second_num;
		quotient = first_num / second_num;
	}
	true_mod(second_inverse,modulus)
}
//modulo_inverse
//Purpose:
//    Given an intger i in the group of integers mod n for some n
//    returns the inverse of i in mod n if it exists.
//Pre-conditions:
//    the modulus is a positive integer greater than one.
//    the number (num) to be inverted is not zero.
modulo_inverse
Purpose:
Given an intger i in the group of integers mod n for some n
returns the inverse of i in mod n if it exists.
Pre-conditions:
the modulus is a positive integer greater than one.
the number (num) to be inverted is not zero.
modulo_inverse Purpose : Given an intger i in the group of integers mod n for some n returns the inverse of i in mod n if it exists . Pre - conditions : the modulus is a positive integer greater than one . the number ( num ) to be inverted is not zero .
pub fn modulo_inverse(num: i32, modulus: i32) -> i32{
    if (modulus < 2) | (num % modulus == 0){
	    return 0;
	}
    let mut first_num = modulus;
	let mut second_num = num % modulus;
	let mut remainder;
	let mut quotient;
	let mut first_inverse = 0;
	let mut second_inverse = 1;
	remainder = first_num % second_num;
	quotient = first_num / second_num;
	while remainder != 0{
	    first_num = second_num;
        second_num = remainder;
		let temp = first_inverse - quotient*second_inverse;
		first_inverse = second_inverse;
        second_inverse = temp;
		remainder = first_num % second_num;
		quotient = first_num / second_num;
	}
	true_mod(second_inverse,modulus)
}
pub fn modulo_inverse ( num : i32 , modulus : i32 ) -> i32 { if ( modulus < 2 ) | ( num % modulus == 0 ) { return 0 ; } let mut first_num = modulus ; let mut second_num = num % modulus ; let mut remainder ; let mut quotient ; let mut first_inverse = 0 ; let mut second_inverse = 1 ; remainder = first_num % second_num ; quotient = first_num / second_num ; while remainder != 0 { first_num = second_num ; second_num = remainder ; let temp = first_inverse - quotient * second_inverse ; first_inverse = second_inverse ; second_inverse = temp ; remainder = first_num % second_num ; quotient = first_num / second_num ; } true_mod ( second_inverse , modulus ) }
modulo_inverse
Purpose:
Given an intger i in the group of integers mod n for some n
returns the inverse of i in mod n if it exists.
modulo_inverse Purpose : Given an intger i in the group of integers mod n for some n returns the inverse of i in mod n if it exists .
num
i32
modulus
i32