Lately I was studying about Modular Arithmetic and the way modulus is used to calculate large numbers. What caught my attention was calculating powers with modulus. It's generally that we calculate the mod of the base and then proceed with our further calculations. Now I was thinking, is it possible to take mod of the power and then mod of that answer to produce the same answer as $(a^b)$%m.
I tried on a few examples to see myself but the answers matched sometimes or would differ many times. So is this really possible with some linear relation, maybe, in the answers by the two methods or is it just not possible?