PrevNext

Overview

Number sense is the backbone of contest math. You should be comfortable with divisibility tests, prime factorizations, and the Euclidean algorithm. Many problems reduce to checking a remainder or rewriting a number in prime powers.

This module covers divisibility, primes, gcd/lcm, and modular arithmetic with simple but powerful tools.

Key Ideas

  • If aba \mid b and aca \mid c, then a(bx+cy)a \mid (bx + cy) for any integers x,yx, y.
  • The Euclidean algorithm computes gcd(a,b)\gcd(a, b) quickly by repeated remainders.
  • Working modulo nn lets you replace numbers by their remainders without changing divisibility information.
  • Prime factorization turns lcm/gcd questions into exponent comparisons.
  • Parity and mod 2/3/5/9 are quick sanity checks.

Core Tools

Divisibility

  • If aba\mid b and aca\mid c, then a(bx+cy)a\mid (bx+cy) for any integers x,yx,y.
  • If aba\mid b and bcb\mid c, then aca\mid c.

GCD and LCM

  • gcd(a,b)lcm(a,b)=ab\gcd(a,b)\cdot\operatorname{lcm}(a,b)=|ab|.
  • Use prime factorization: gcd uses min exponents, lcm uses max exponents.

Euclidean Algorithm

Compute gcd(a,b)\gcd(a,b) by repeated remainders:

a=bq+r,gcd(a,b)=gcd(b,r).a=bq+r,\quad \gcd(a,b)=\gcd(b,r).

Modular Arithmetic

You can add, subtract, and multiply residues:

ab(modn)a+cb+c,  acbc(modn).a\equiv b\pmod n \Rightarrow a+c\equiv b+c,\; ac\equiv bc\pmod n.

If ab(modn)a\equiv b\pmod n, then akbk(modn)a^k\equiv b^k\pmod n.

Worked Example

Find the remainder of 720267^{2026} when divided by 99.

Because 72(mod9)7 \equiv -2 \pmod 9, we have 72026(2)20267^{2026} \equiv (-2)^{2026}. Since 20262026 is even, (2)2026=22026(-2)^{2026} = 2^{2026}. We can use the cycle 21,22,23,242,4,8,7(mod9)2^1, 2^2, 2^3, 2^4 \equiv 2, 4, 8, 7 \pmod 9 with period 66. Compute 202620266337=4(mod6)2026 \equiv 2026 - 6 \cdot 337 = 4 \pmod 6, so the remainder is 2472^4 \equiv 7.

More Examples

Example 1: GCD via Euclid

Compute gcd(84,54)\gcd(84,54).

84=541+3084=54\cdot1+30, 54=301+2454=30\cdot1+24, 30=241+630=24\cdot1+6, 24=64+024=6\cdot4+0. So gcd=6\gcd=6.

Example 2: LCM from Prime Factors

Find lcm(12,18)\operatorname{lcm}(12,18).

12=22312=2^2\cdot3, 18=23218=2\cdot3^2, so lcm is 2232=362^2\cdot3^2=36.

Example 3: Quick Divisibility

Is 73447344 divisible by 99? Sum of digits is 7+3+4+4=187+3+4+4=18, divisible by 99, so 73447344 is divisible by 99.

Strategy Checklist

  • Can you reduce the problem to prime factorization?
  • Is Euclid faster than factoring?
  • Can a small modulus simplify the expression?
  • Does parity or a digit test give a quick answer?

Common Pitfalls

  • Forgetting that congruence only preserves addition and multiplication.
  • Mixing up gcd\gcd and lcm\operatorname{lcm} relationships.
  • Treating a/ba/b as valid in modular arithmetic when bb is not invertible.

Practice Problems

StatusSourceProblem NameDifficultyTags
AMC 8Easy
Show TagsDivisibility, Remainders
AMC 10Easy
Show TagsGCD, Prime Factorization

Module Progress:

Join the AoPS Community!

Stuck on a problem, or don't understand a module? Join the AoPS community and get help from other math contest students.

PrevNext