// Lawrence Bush // Lab Session: 1 // RCS account: bushl // mmi.h - This header file contains a function which // computes the Modular Multiplicative Inverse. #ifndef MMI_H #define MMI_H #include void getxy(const long int & A, const long int & P, long int & X, long int & Y) { if (P==0) {X=1; Y=0; return;} // Base Case // When P = 0, the equation AX+PY=1 can be solved by // X = 1, Y = 0 (or anything) // R=M%N; getxy(P,A%P,X,Y); // This line recursively call itself // until the base case is found. // I reduces by mod and switches A and P. // The program never goes past here until the base case // is found and regurned. //std::cout<< "prexy A="<