View Single Post
Old 2020-09-15, 15:50   #12
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

3,533 Posts
Default

Code:
Mod(10,107)^100000000000000000000000000000000000000000
Mod(34, 107)

##
  ***   last result computed in 0 ms
.

It actually works by left-right binary exponentiation modulo n

And since 107 is prime we can use Fermat's little theorem:

Code:
Mod(10,107)^(100000000000000000000000000000000000000000%106)
Mod(34, 107)
Or something even "bigger":

Code:
Mod(10,107)^(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000%106)
Mod(4, 107)

Last fiddled with by paulunderwood on 2020-09-15 at 16:06
paulunderwood is offline   Reply With Quote