📄 solvlincong.m
字号:
function x = solvlincong(a,m,b)
%
% Ddetermine the solution to the linear congruence
% a x equiv b (mod m), if it exists
%
% function x = solvlincong(a,m,b)
% Copyright 1999 by Todd K. Moon
[g,x,y] = gcdint2(a,m);
if(rem(b,g))
error('no solution to the congruence');
end
alpha = a/g;
beta = b/g;
mu = m/g;
[g1,alphabar,gamma] = gcdint2(alpha,mu);
x0 = mod(alphabar*beta,m);
x = mod(x0+(0:g-1)*mu,m);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -