Okay, that's all fun. But we need power, too. Here's an example of such power. Even though I'm not physically present, I can do amazing computations! Let me compute \(2^{1000000000}\) (mod \(3\))! I'll do it instantaneously.
Ready for the answer? It's 1!
Perhaps you don't believe an absent author. We can check it with Sage:
Hmm, but that took more than a few milliseconds – strange that I could do it so fast!
Now consider that I did this huge computation instantaneously in my head. Surely I must be full of brains, like the Scarecrow in L. Frank Baum's Oz books?
Of course, the reason is not that I am clever, but that congruence can be turned into arithmetic! Unlike the Wizard, I will give away my secret. I just used the following useful property.
Fact4.2.3
If \(a\equiv b\text{ (mod }n)\), then \(a^m\equiv b^m\text{ (mod }n)\) no matter how huge \(m\) is.
Now I do my first congruence computation: \begin{equation*}2\equiv -1\text{ (mod }3)\text{ and }(-1)^{1000000000}=1\; ,\end{equation*} the latter like all even powers of negative one. Ta-dah!
What I've done is first think of the original number as in the congruence, and then taken its power.
Subsection4.2.1Computer diversion
Sage can verify this approach is much faster, and even for much bigger powers. Here we will need to use the mod(x,m) syntax:
Even the presumptively very, very big latter computation should be as fast as your internet connection.
This was a lot of computer business. The point is that if the computer thinks it's a good idea to just think of the remainder before you do any arithmetic, maybe we should too.