Hi is there a general formula to find the inverse modulo of "a modulo n"...

i know its denoted as $\displaystyle a^{-1}$ and

$\displaystyle a.a^{-1} = 1 mod n$

for example if a=29 and n = 78 then the inverse is 35 since: 29.35 = 1 mod 78...

(a)

butHOW DO U CALCULATE THE INVERSE?is there a formula?? please help me out here?

(b)

and how can this be used to solve 43 modulo 125, hence solve 43x = 3 mod 125

thanks :)