5 ms·
n = 2048 2048 times: n = n*2^n Now we use the fact that we only need the last 10 digits. n = 2048 2048 times: n = (n*2^n) % 10^10
by cperciva 16y ago
n = 2048
2048 times:
n = n*2^n
Now we use the fact that we only need the last 10 digits.
n = 2048
2048 times:
n = (n*2^n) % 10^10
CHEAT! x^y mod N is not necessarily the same as x^(y mod N) mod N.
In this case it happens to be true, but you really should explain why.