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)