retagged by
732 views
0 votes
0 votes
How to calculate modulus of an exponential number?
retagged by

1 Answer

Best answer
1 votes
1 votes
(a*b)%m = (a%m * b%m)%m

so if you have a very big number like (3^100) % m, you can write it as by dividing it into smaller parts (((3^20)%m)^5) % m

It is just modular arithmetic.
selected by

Related questions

3 votes
3 votes
3 answers
1
jugnu1337 asked Mar 5, 2023
1,873 views
the solution of the linear congruence 4x = 5(mod9)? 6 (mod 9)8 (mod 9)9(mod 9)10 (mod 9)
0 votes
0 votes
0 answers
2
manisha11 asked Jan 2, 2019
268 views
In an undirected graph a self loop counts to how many edges?I read somewhere that in case of undirected graph we consider self loop to have 2 edges?
0 votes
0 votes
1 answer
4