Technique
Reduce a large power by the cycle of its base modulo
Arithmetic • Number System • Divisibility
Statement
For a fixed modulus and a base coprime to , the powers repeat modulo with some cycle length , where is the smallest exponent with . Writing then gives .
How to use it
- 1Reduce the base modulo first, then compute until reappears; that exponent is .
- 2Divide the exponent by and keep only the remainder ; a remainder of means .
- 3This works for a composite modulus, where Fermat's little theorem does not apply.
Worked example
What is the remainder when is divided by ?
Step-by-step
- 1, ,
Why: The cycle closes at the third power, so .
- 2
Why: Only the remainder of the exponent modulo matters.
- 3
Answer
Watch out
The base must be coprime to the modulus; if it shares a factor, the powers never return to and this fails. The cycle length divides Euler's but is often shorter, so it must be found rather than assumed.