I am confused in taking modulo in several questions. Generally it is %1000000007, but in some cases we take %1000000006 in between. When to take %1000000007 and %1000000006?

Can you give an example of where you’ve seen this?

if u calculate a^{b} %m then simple but if u wanna calculate a^b^c %m then we have to calculate res = b^{c} %(m-1) then calculate a^{res} %m

thank you!!!

1 Like