News

Math League Remainder Patterns: Use a Short Cycle to Handle a Large Exponent

October 15, 20269 min read

Math League number-theory questions often ask for the remainder when a large power is divided by a small modulus. The direct computation is impossible in contest time. The practical solution is to exploit the short cycle that remainders follow when successive powers are reduced modulo the same number. Once you identify the cycle length, you replace the large exponent with a much smaller equivalent exponent, compute the modest power that remains, and read off the remainder. This article explains the mechanism, works a checked example, shows where a superficially similar approach fails, and gives a short diagnostic to confirm whether you have mastered the idea.

Why Remainders Form a Cycle

Consider the sequence of powers of a fixed base a: a¹, a², a³, a⁴, … . When each term is divided by a fixed modulus m, only finitely many remainders are possible—specifically, the remainders 0, 1, 2, …, m−1. Once a remainder repeats, the sequence of subsequent remainders must repeat as well, because each remainder depends only on the previous remainder and the fixed base. Therefore the sequence of remainders is eventually periodic.

In the common contest case where a and m share no common factor, the cycle begins immediately with a¹; the remainders enter a repeating loop. When a and m share a common factor, there may be an initial pre-period before the cycle starts, or the remainders may collapse to zero. The key insight is that cycles exist in both cases, but the handling differs.

How we can help
  • Contest registration
  • Free past papers
  • 1-on-1 trial lesson
Math League WhatsApp QR
WhatsApp
Math League WeChat QR
WeChat

This periodicity is the foundation of the shortcut. When the cycle begins at the first power and has length k with a^k ≡ 1 (mod m), we can write N = qk + r with 0 ≤ r < k, and conclude that a^N ≡ a^r (mod m). More generally, for any cycle, once the repeating pattern is identified, the exponent can be reduced using the cycle length to find the correct position.

A Worked Teaching Case: Remainder of 7^100 Divided by 9

Let us work through a concrete example that illustrates every step. We want the remainder when 7^100 is divided by 9.

Step 1: Compute early remainders to find the cycle.

  • 7¹ = 7, remainder 7 when divided by 9.
  • 7² = 49, remainder 49 − 5·9 = 49 − 45 = 4 when divided by 9.
  • 7³ = 7² · 7 ≡ 4 · 7 = 28, remainder 28 − 3·9 = 28 − 27 = 1 when divided by 9.
  • 7⁴ = 7³ · 7 ≡ 1 · 7 = 7, remainder 7 when divided by 9.

The remainders are 7, 4, 1, 7, … . The cycle is (7, 4, 1) with length 3.

Step 2: Reduce the exponent using the cycle length.

We need 100 mod 3. Since 100 = 33·3 + 1, we have 100 ≡ 1 (mod 3).

Step 3: Read off the answer from the cycle position.

Because the remainder pattern repeats every 3 powers and 100 ≡ 1 (mod 3), the remainder of 7^100 divided by 9 equals the first element of the cycle, which is 7.

Verification of the cycle: We checked 7¹ ≡ 7, 7² ≡ 4, 7³ ≡ 1, and 7⁴ ≡ 7 (mod 9). The cycle length is indeed 3, and the arithmetic 4·7 = 28 ≡ 1 (mod 9) and 1·7 = 7 (mod 9) is correct. The answer 7 is verified.

Cycle Detection Flow

A Contrasting Case: Where Coprimality Fails and Where It Does Not Tell the Whole Story

Consider finding the remainder of 6^100 when divided by 9.

Direct analysis:

  • 6¹ = 6, remainder 6 when divided by 9.
  • 6² = 36, remainder 0 when divided by 9.
  • 6³ = 6² · 6 ≡ 0 · 6 = 0, remainder 0 when divided by 9.

Here the remainders are 6, 0, 0, 0, … . There is no cycle of length greater than 1 among the non-zero remainders. The sequence collapses to 0 and stays there. The reason is that 6 and 9 share a common factor: gcd(6, 9) = 3 ≠ 1.

What goes wrong with naive cycle reduction: The formula a^N ≡ a^(N mod k) (mod m) requires that a^k ≡ 1 (mod m), which only happens when gcd(a,m) = 1. When they are not coprime, this reduction fails. For 6^100 mod 9, since 6² ≡ 0 (mod 9), we have 6^100 = 6² · 6^98 ≡ 0 · 6^98 ≡ 0 (mod 9). The remainder is 0, found by direct observation, not by cycle reduction.

However, not all non-coprime cases hit zero: A common misconception is that all non-coprime cases collapse to zero. This is false. Consider 2^n mod 6:

  • 2¹ = 2, remainder 2 when divided by 6.
  • 2² = 4, remainder 4 when divided by 6.
  • 2³ = 8, remainder 2 when divided by 6.
  • 2⁴ = 16, remainder 4 when divided by 6.

The cycle is (2, 4) with length 2. Since 100 is even, 2^100 mod 6 = 4, not 0. This is a non-coprime case with a non-zero cycle. The cycle method works here, but one must handle the pre-period correctly: the cycle starts at n=1, not at a^0 = 1.

The lesson: Non-coprime cases require careful analysis. Some collapse to zero; others enter a non-zero cycle. The formula a^N ≡ a^(N mod k) (mod m) only applies when a^k ≡ 1 (mod m), which requires coprimality. For general cycle handling, track the actual cycle positions from the first positive power, not from a hypothetical zeroth power.

The General Procedure for Contest Use

Based on the verified cases above, here is the procedure to apply under exam conditions:

  1. Check whether gcd(base, modulus) = 1. If yes, the cycle begins at the first power; compute successive powers modulo the modulus until a remainder repeats.
  2. If gcd(base, modulus) ≠ 1, compute several powers to detect whether the remainders collapse to 0 or enter a non-zero cycle with a possible pre-period.
  3. Identify the cycle length k and the starting position of the cycle.
  4. Reduce the exponent: find the equivalent position within the cycle. If the cycle starts at power s with length k, then for N ≥ s, find r = (N − s) mod k and use the r-th position (0-indexed) in the cycle.
  5. Compute the final remainder from the identified cycle position.

This procedure is reliable for Math League number-theory questions at all grade levels where remainder problems appear. The key discipline is recognizing that coprime cases give clean a^k ≡ 1 cycles, while non-coprime cases need explicit cycle detection.

A Short Diagnostic: Three Questions to Test Mastery

Try these problems and check your reasoning against the solutions:

Question 1: What is the remainder when 2^50 is divided by 7?

Question 2: What is the remainder when 3^40 is divided by 11?

Question 3: What is the remainder when 2^100 is divided by 6?

Annotated solutions:

Question 1: Check gcd(2, 7) = 1. Powers of 2 mod 7: 2¹ ≡ 2, 2² ≡ 4, 2³ ≡ 1, cycle length 3. Then 50 = 16·3 + 2, so 2^50 ≡ 2² ≡ 4 (mod 7). Remainder: 4.

Question 2: Check gcd(3, 11) = 1. Powers of 3 mod 11: 3¹ ≡ 3, 3² ≡ 9, 3³ ≡ 27 ≡ 5, 3⁴ ≡ 15 ≡ 4, 3⁵ ≡ 12 ≡ 1, cycle length 5. Then 40 = 8·5 + 0, so 3^40 ≡ 1 (mod 11) using the last position in the cycle. Remainder: 1.

Question 3: Check gcd(2, 6) = 2 ≠ 1. Powers of 2 mod 6: 2¹ ≡ 2, 2² ≡ 4, 2³ ≡ 2, cycle (2, 4) with length 2 starting at n=1. Since 100 ≥ 1 and (100 − 1) = 99, 99 mod 2 = 1, so we use the second position: 2^100 ≡ 4 (mod 6). Remainder: 4.

If you answered all three correctly with correct cycle identification, you have mastered the core skill. If you missed Question 3, you may have incorrectly assumed non-coprime means zero, or applied a^N ≡ a^(N mod k) without verifying a^k ≡ 1. If you missed Question 2, review the handling of exponent congruent to 0 modulo the cycle length.

What the Diagnostic Result Means for Next Steps

The diagnostic above serves a specific purpose: it distinguishes between students who have memorized a pattern and those who understand the conditions for its valid use. A student who correctly handles Question 2 (exponent multiple of cycle length in coprime case) and Question 3 (non-coprime with non-zero cycle) has transferable mastery. A student who stumbles on Question 3 may have overfitted to the coprime case and needs explicit practice with non-coprime examples.

The most useful feedback at this stage is to work five more problems with moduli between 6 and 15, varying both the base and whether the base and modulus are coprime. This builds the automaticity needed for contest conditions. For additional structured practice, see our article on Number Theory on Math League: Divisibility, Remainders and Digit Questions, Decoded (Grades 6-12), which covers the broader context of remainder problems.

Connections to Related Topics

Remainder cycle problems sit at the intersection of several Math League topics. The skill of modular cycle reduction also appears in Counting and Probability on Math League: The Four Questions That Decide Every Problem (2026) where periodic patterns govern outcomes. The underlying principle—finite state spaces lead to eventual repetition—is identical.

Students who have mastered this article’s content and seek to confirm their readiness for full contest conditions may consult our guide on How to Practise With Math League Past Contests: A Paper-by-Paper Protocol (2026) for timed practice methods.

Preparing for Consultation: What to Bring

If you are considering structured preparation support, the most productive initial conversation covers:

  • Which of the three diagnostic questions above you solved correctly, and where your reasoning differed from the annotated solutions.
  • Whether you habitually check gcd(base, modulus) before deciding which cycle method applies.
  • Your current contest practice schedule and which past papers you have attempted under timed conditions.

This information allows any consultation to focus on specific skill gaps rather than generic review. The cycle-reduction method itself is teachable in a single session; the discipline of condition-checking (the gcd test and non-coprime case handling) typically requires targeted practice over two to three weeks to become automatic.

Three Cases Compared

Frequently Asked Questions

Does the cycle method work for every remainder problem on Math League?

The cycle method works for all remainder problems, but the handling differs. When base and modulus are coprime, the cycle starts immediately and a^k ≡ 1 (mod m), allowing simple exponent reduction. When not coprime, there may be a pre-period before the cycle starts, or the remainders may collapse to zero. Always compute several powers explicitly when gcd ≠ 1.

What do I do if the exponent is a multiple of the cycle length?

When the base and modulus are coprime with cycle length k and a^k ≡ 1 (mod m), exponents that are multiples of k yield remainder 1. For example, with the cycle (7, 4, 1) for 7^n mod 9, exponents 3, 6, 9, … all give remainder 1. More generally, for a cycle starting at power s with length k, reduce using (N − s) mod k to find the correct position. In non-coprime cases like 2^n mod 6 with cycle (2, 4), even exponents give 4 and odd exponents give 2.

How do I practice this efficiently without doing full contest papers?

Generate five problems of the form ‘Find the remainder when a^N is divided by m’ with m between 6 and 15, a between 2 and m−1, and N between 20 and 100. Include at least one non-coprime pair. Time yourself for two minutes per problem. Review any case where you assumed coprimality without checking, or incorrectly applied a^N ≡ a^(N mod k) when a^k is not ≡ 1.

How we can help
  • Contest registration
  • Free past papers
  • 1-on-1 trial lesson
← All news & guides
Math League WhatsApp QR
WhatsApp
Math League WeChat QR
WeChat