((my) mod n ) congruent to n-1

by smslca
Tags: congruent
 P: 688 Hi, smsica, you are looking for a solution to the congruency$$my \equiv -1 \pmod n$$The definition of congruency says that two numbers are congruent to n when their difference is a multiple of n; so solving this congruency can be expressed as finding integers y,k such that$$my+1 = nk$$or$$nk-my = 1$$Call z = -y, and look for solutions k,z to$$nk+mz = 1$$You do that using the Extended Euclidean Algorithm; you will find that a solution can only be found when m and n are coprime, that is, when GCD(m,n)=1. There is a simpler example here (with numbers whose GCD is larger than 1, but the mechanics of the algorithm are the same): http://www.mast.queensu.ca/~math418/m418oh/m418oh04.pdf