RosettaCodeData/Task/Modular-exponentiation/00-TASK.txt

14 lines
676 B
Plaintext

Find the last &nbsp; '''40''' &nbsp; decimal digits of &nbsp; <math>a^b</math>, &nbsp; where
::* &nbsp; <math>a = 2988348162058574136915891421498819466320163312926952423791023078876139</math>
::* &nbsp; <math>b = 2351399303373464486466122544523690094744975233415544072992656881240319</math>
A computer is too slow to find the entire value of &nbsp; <math>a^b</math>.
Instead, the program must use a fast algorithm for [[wp:Modular exponentiation|modular exponentiation]]: &nbsp; <math>a^b \mod m</math>.
The algorithm must work for any integers &nbsp; <math>a, b, m</math>, &nbsp; &nbsp; where &nbsp; <math>b \ge 0</math> &nbsp; and &nbsp; <math>m > 0</math>.
<br><br>