September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,22 @@
|
|||
/* Modular exponentiation */
|
||||
|
||||
numeric digits 100
|
||||
say powerMod(,
|
||||
2988348162058574136915891421498819466320163312926952423791023078876139,,
|
||||
2351399303373464486466122544523690094744975233415544072992656881240319,,
|
||||
1e40)
|
||||
exit
|
||||
|
||||
powerMod: procedure
|
||||
|
||||
use strict arg base, exponent, modulus
|
||||
|
||||
exponent=exponent~d2x~x2b~strip('L','0')
|
||||
result=1
|
||||
base = base // modulus
|
||||
do exponentPos=exponent~length to 1 by -1
|
||||
if (exponent~subChar(exponentPos) == '1')
|
||||
then result = (result * base) // modulus
|
||||
base = (base * base) // modulus
|
||||
end
|
||||
return result
|
||||
Loading…
Add table
Add a link
Reference in a new issue