2016-09-11 11 views
0

モジュラ乗法逆関数の計算に問題があります。 例私は整数A = 151M = 541を持っています。 151 mod 541. inverse mod 151 to 541は43 どのようにモジュール乗法逆行列を計算するのですか?matlabのモジュール乗法逆関数

答えて

0

これは、次のようにgcdmod機能を使用して行うことができます。

A = 151; M = 541; 

[G, C, ~] = gcd(A,M); 
if G==1 % The inverse of a(mod b) exists only if gcd(a,b)=1 
    ModMultInv = mod(C,M) 
else disp('Modular multiplicative inverse does not exist for these values') 
end 

出力: -

ModMultInv = 
    43