I understood till 2^36 when divided by 7 , remainder will be 1 .

Then how do we get ans as 6??

4 posts were merged into an existing topic: The remainder when 8^12 − 2 is divided by 7