Modular Exponentiation 2 by uru

begin
repeat
var a,b,c,r:comp=1;read(a,b,c);repeat
if b mod 2>0then r:=r*a mod c;b:=b div 2;a:=a*a mod c;until b=0;writeln(r)until 1=0end.

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page