I want to calculate for example 257^150 but matlab shows until 257^126. I want to find the exponent "x" in order to compute the modulus. For example the power which gives (257^x mod 1009) = 369. Thanks.
Think about the problem and how you would solve it. You know hat mod(x,42)
is 23
. What is the remainder of 7*x
? Its mod(7*42,23)
Put into code:
a=257;
m=1009;
s=369;
r=1;
x=0;
while(not(r==s))
x=x+1;
r=mod(r*a,m);
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.