All we need is .
It's perhaps a little confusing since the letters overlap.
Let's rewrite the mathworld property as follows
Let (mod m) and (mod m), then
I like TwistedOne151's approach, but it's good to know what kinds of rules you can apply with congruences, which can make things easier in general, for example
as long as
This will help later on; for example, using Euler's theorem, you will be able to do this manipulation:
given that gcd(a,n)=1.