Number theory is the signature battleground of Saudi NSMO, KAUST KMC, AIME, and the IMO. Mastering congruence arithmetic\pmod m(modm), Euler’s totient theorem, the Chinese Remainder Theorem (CRT), and pp-adic valuation \(v_p(n)\) converts enormous exponential expressions and divisibility claims into crisp, finite modular deductions.
By the Fundamental Theorem of Arithmetic, every integer \( n > 1 \) factors uniquely as \( n = p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k} \). Its key multiplicative invariants are:
For a prime \( p \), the \( p \)-adic valuation \( v_p(n) \) is the largest exponent \( e \) such that \( p^e \mid n \). Legendre's Theorem gives the exact prime power dividing \( n! \):
1. Euler's & Fermat's Theorems: If \( \gcd(a, m) = 1 \), then \( a^{\varphi(m)} \equiv 1 \pmod m \). In particular, for prime \( p \nmid a \), \( a^{p-1} \equiv 1 \pmod p \).
2. Wilson's Theorem: An integer \( p > 1 \) is prime if and only if \( (p - 1)! \equiv -1 \pmod p \) (and \( (p - 2)! \equiv 1 \pmod p \)).
3. Chinese Remainder Theorem (CRT): If \( m_1, m_2, \dots, m_r \) are pairwise coprime (\( \gcd(m_i, m_j) = 1 \)), then the system \( x \equiv c_i \pmod{m_i} \) has a unique solution modulo \( M = m_1 m_2 \cdots m_r \).
Let \( R = \{r_1, r_2, \dots, r_{\varphi(m)}\} \) be a reduced residue system modulo \( m \) (all \( 1 \le r_i \le m \) with \( \gcd(r_i, m) = 1 \)). Since \( \gcd(a, m) = 1 \), multiplication by \( a \) is injective modulo \( m \): if \( ar_i \equiv ar_j \pmod m \), multiplying by \( a^{-1} \pmod m \) yields \( r_i \equiv r_j \pmod m \). Moreover \( \gcd(ar_i, m) = 1 \), so \( \{ar_1, \dots, ar_{\varphi(m)}\} \) is simply a permutation of \( R \) modulo \( m \)! Multiplying all elements together gives:
\[ (ar_1)(ar_2)\cdots(ar_{\varphi(m)}) \equiv r_1 r_2 \cdots r_{\varphi(m)} \pmod m \implies a^{\varphi(m)} \prod_{i=1}^{\varphi(m)} r_i \equiv \prod_{i=1}^{\varphi(m)} r_i \pmod m. \]
Since \( \gcd\!\left(\prod r_i, m\right) = 1 \), we cancel \( \prod r_i \) to obtain \( a^{\varphi(m)} \equiv 1 \pmod m \). \( \blacksquare \)
Slide \(a\) and \(b\) to watch Euclidean square-tiling peel off quotients until the final square side equals \(\gcd(a, b)\). Whenever \(\gcd(a, b) = 1\), the Bézout coefficient \(x \bmod b\) gives the modular inverse \(a^{-1} \pmod b\)!
Primitive-root star polygon modulo \(7\): powers of \(3 \pmod 7\) cycle through all \(\varphi(7) = 6\) nonzero residues \(3 \to 2 \to 6 \to 4 \to 5 \to 1\), illustrating multiplicative order \(\operatorname{ord}_7(3) = 6\).
Worked Example 2.A — Last Two Digits of a Power Tower via CRT + Euler (NSMO / KAUST)
Problem. Find the last two decimal digits of \( 7^{2026} \) (i.e., compute \( 7^{2026} \bmod 100 \)).
Worked Example 2.C — Chinese Remainder Theorem Reconstruction (AIME / NSMO Stage 2)
Problem. Find the smallest positive integer \( N > 10 \) that leaves remainder \( 2 \) when divided by \( 5 \), remainder \( 4 \) when divided by \( 7 \), and remainder \( 6 \) when divided by \( 9 \).
▸ Show step-by-step solution
Look for a structural pattern in the remainders before brute-forcing CRT! At \( m = 5, 7, 9 \), the differences \( m - r \) are \( 5 - 2 = 3 \), \( 7 - 4 = 3 \), and \( 9 - 6 = 3 \) — every single remainder is 3 less than its modulus! That means: \[ N \equiv -3 \pmod 5, \quad N \equiv -3 \pmod 7, \quad N \equiv -3 \pmod 9. \] Since \( 5, 7, 9 \) are pairwise coprime with \( \operatorname{lcm}(5, 7, 9) = 315 \), CRT immediately gives \( N \equiv -3 \equiv 312 \pmod{315} \). Thus the smallest positive solution is \( N = 312 \).
Worked Example 2.D — Legendre's Valuation & Divisor Count (KAUST Finals / IMO Shortlist)
Problem. Find the largest integer \( k \) such that \( 12^k \) divides \( 60! \).
▸ Show step-by-step solution
Prime-factor the base first: \( 12 = 2^2 \cdot 3 \), so \( 12^k = 2^{2k} \cdot 3^k \). Thus \( 12^k \mid 60! \iff 2k \le v_2(60!) \) AND \( k \le v_3(60!) \), meaning \( k = \min\!\left(\left\lfloor \frac{v_2(60!)}{2} \right\rfloor,\; v_3(60!)\right) \). 1. Compute \( v_3(60!) \) by Legendre's formula: \[ v_3(60!) = \left\lfloor \frac{60}{3} \right\rfloor + \left\lfloor \frac{60}{9} \right\rfloor + \left\lfloor \frac{60}{27} \right\rfloor = 20 + 6 + 2 = 28. \] 2. Compute \( v_2(60!) \): \[ v_2(60!) = \left\lfloor \frac{60}{2} \right\rfloor + \left\lfloor \frac{60}{4} \right\rfloor + \left\lfloor \frac{60}{8} \right\rfloor + \left\lfloor \frac{60}{16} \right\rfloor + \left\lfloor \frac{60}{32} \right\rfloor = 30 + 15 + 7 + 3 + 1 = 56. \] 3. Compare constraints: \( \lfloor 56 / 2 \rfloor = 28 \) and \( v_3(60!) = 28 \)! Both bounds Tie at \( 28 \) — had you lazily assumed \( 3 \) is always the bottleneck without checking \( 2^2 \), you could miss cases like \( 8! \) (where \( v_3(8!) = 2 \) and \( \lfloor v_2(8!)/2 \rfloor = \lfloor 7/2 \rfloor = 3 \), vs \( 9! \) where \( v_3(9!) = 4 > \lfloor 7/2 \rfloor = 3 \)!). Here \( k = \min(28, 28) = 28 \).
⚠ Olympiad Trap — Never Reduce Exponents Modulo m Instead of φ(m)!
Exponents live modulo \( \varphi(m) \), NOT modulo \( m \)! Moreover, \( a^{\varphi(m)} \equiv 1 \pmod m \) requires \( \gcd(a, m) = 1 \). If \( \gcd(a, m) > 1 \) (for instance \( 6^{100} \bmod 40 \)), split \( 40 = 8 \times 5 \) into prime-power moduli via CRT: clearly \( 6^{100} \equiv 0 \pmod 8 \) (since \( 100 \ge 3 \)) and \( 6^{100} \equiv 1^{100} = 1 \pmod 5 \), yielding \( 6^{100} \equiv 16 \pmod{40} \) — NOT \( 1 \)!
▲ Contest Strategy — Euclidean Elimination on Variable Expressions
Whenever asked for the maximum possible value of \( \gcd(A(n), B(n)) \) as \( n \) varies over \( \mathbb{Z}^+ \) (e.g., \( \gcd(3n + 7, 5n + 2) \)), eliminate \( n \) linearly: \( d \mid 5(3n+7) - 3(5n+2) = 35 - 6 = 29 \). Thus \( d \in \{1, 29\} \), and checking \( 3n + 7 \equiv 0 \pmod{29} \implies n = 27 \) confirms \( 29 \) is achieved!
[Practice 2.1 · NSMO Stage 1 / Easy] How many positive integer divisors of \( 720 \) are perfect squares?
💡 Hint 1 of 3
Write the prime factorization \( 720 = 2^4 \cdot 3^2 \cdot 5^1 \).
💡 Hint 2 of 3
A divisor \( 2^a 3^b 5^c \) is a perfect square iff \( a, b, c \) are all even.
💡 Hint 3 of 3
Count valid choices: \( a \in \{0,2,4\} \), \( b \in \{0,2\} \), \( c \in \{0\} \).
Since \( 720 = 2^4 \cdot 3^2 \cdot 5^1 \), even exponents allow \( 3 \) choices for \( a \) (\(0,2,4\)), \( 2 \) choices for \( b \) (\(0,2\)), and \( 1 \) choice for \( c \) (\(0\)), giving \( 3 \times 2 \times 1 = 6 \) square divisors.
[Practice 2.2 · KAUST KMC / Easy] Compute Euler totient \( \varphi(360) \) — the number of integers \( 1 \le k \le 360 \) coprime to \( 360 \).
💡 Hint 1 of 3
Find the distinct prime factors of \( 360 = 2^3 \cdot 3^2 \cdot 5 \): primes \( 2, 3, 5 \).
In all three congruences, \( 2x + 1 \equiv 0 \pmod m \) for \( m \in \{3, 5, 7\} \). By CRT, \( 2x + 1 \equiv 0 \pmod{105} \). Taking \( 2x + 1 = 105 \) gives \( x = 52 \) (checking: \( 52 = 17(3)+1 = 10(5)+2 = 7(7)+3 \)).
[Practice 2.5 · NSMO National Finals / LTE] Using Lifting-the-Exponent (LTE), find the exact 3-adic valuation \( v_3(7^{54} - 1) \) — i.e., the largest integer \( k \) such that \( 3^k \mid (7^{54} - 1) \).
💡 Hint 1 of 3
Check LTE conditions for odd prime \( p = 3 \): \( x = 7, y = 1 \), so \( 3 \mid (7 - 1) = 6 \) and \( 3 \nmid 7 \cdot 1 \).
💡 Hint 2 of 3
Apply \( v_3(x^n - y^n) = v_3(x - y) + v_3(n) \) with \( x = 7, y = 1, n = 54 \).
Since \( p = 3 \) is an odd prime with \( 3 \mid (7 - 1) \) and \( 3 \nmid 7 \), LTE gives \( v_3(7^{54} - 1) = v_3(6) + v_3(54) = 1 + 3 = 4 \). Thus \( 3^4 = 81 \) is the highest power of \( 3 \) dividing \( 7^{54} - 1 \).
Number Theory I: Divisibility, Primes, Fermat–Euler Theorems & Chinese Remainder Theorem — Competition Proof Benchmark
6 pts
No Calculator
For positive integer \(n\) and quadratic \(P(x) = x^2 + 3x + 10\) in Number Theory I: Divisibility, Primes, Fermat–Euler Theorems & Chinese Remainder Theorem, examine algebraic invariants below.
(a)2 pts
Express \(4P(x)\) as a square plus a positive constant.
Scoring Guideline & Justification
[M1]Completes square on 4x^2 + 12x(1 pt)
[A1]Obtains (2x + 3)^2 + 31(1 pt)
(b)2 pts
Deduce why \(P(n)\) has no real roots for any \(n\in\mathbb{R}\).
Scoring Guideline & Justification
[M1]Bounds squared term >= 0(1 pt)
[A1]Proves strict positivity for all real x(1 pt)
(c)2 pts
Find the remainder when \(P(10) - P(0)\) is divided by \(10\).