15 lines
473 B
Text
15 lines
473 B
Text
|
|
F pow_mod(BigInt =base, BigInt =exponent, BigInt modulus)
|
|||
|
|
BigInt result = 1
|
|||
|
|
|
|||
|
|
L exponent != 0
|
|||
|
|
I exponent % 2 != 0
|
|||
|
|
result = (result * base) % modulus
|
|||
|
|
exponent I/= 2
|
|||
|
|
base = (base * base) % modulus
|
|||
|
|
|
|||
|
|
R result
|
|||
|
|
|
|||
|
|
print(pow_mod(BigInt(‘2988348162058574136915891421498819466320163312926952423791023078876139’),
|
|||
|
|
BigInt(‘2351399303373464486466122544523690094744975233415544072992656881240319’),
|
|||
|
|
BigInt(10) ^ 40))
|