Number Theory

Study Sheet

Number Theory

Orders, valuations, quadratic residues, Diophantine equations, divisor sums

Proof-Level Number Theory

Tip
Orders, primitive roots, and CRT

The order of aa mod nn divides every kk with ak1a^k \equiv 1, hence divides φ(n)\varphi(n). Compute orders mod composites prime-power by prime-power and take the lcm.

Last two digits of 320263^{2026}: the order of 33 mod 100100 is 2020, and 202662026 \equiv 6, so 36=729293^6 = 729 \to 29. Mod 2k2^k (k3k \ge 3) the equation x21x^2 \equiv 1 has FOUR solutions, so x21(mod24)x^2 \equiv 1 \pmod{24} has 42=84\cdot2 = 8 — a standard trap. Primitive roots exist exactly mod 2,4,pk,2pk2, 4, p^k, 2p^k.

Tip
Valuations: Legendre, Kummer, LTE

vp(n!)=k1n/pkv_p(n!) = \sum_{k\ge1}\lfloor n/p^k\rfloor; vp(nk)v_p\binom{n}{k} is the number of carries adding k+(nk)k + (n-k) in base pp; vp(anbn)=vp(ab)+vp(n)v_p(a^n - b^n) = v_p(a - b) + v_p(n) for odd pabp \mid a - b.

v5(1000!)=200+40+8+1=249v_5(1000!) = 200 + 40 + 8 + 1 = 249. v2(20261013)v_2\binom{2026}{1013} is the number of 11-bits of 10131013. LTE: v3(2243+1)=1+5=6v_3(2^{243} + 1) = 1 + 5 = 6 (the an+bna^n + b^n form for odd nn). Valuations turn "largest power dividing" into arithmetic, and they are the language of most Putnam number theory write-ups.

Tip
Divisor sums and multiplicative functions

τ\tau, σ\sigma, φ\varphi are multiplicative: compute on prime powers and multiply. σ(360)=15136=1170\sigma(360) = 15\cdot13\cdot6 = 1170; dnφ(d)=n\sum_{d\mid n}\varphi(d) = n.

Sums over divisors are attacked by swapping the order of summation: nNτ(n)=dNN/d\sum_{n\le N}\tau(n) = \sum_{d\le N}\lfloor N/d\rfloor. Möbius inversion recovers ff from F(n)=dnf(d)F(n) = \sum_{d\mid n}f(d). Quadratic residues: (1p)=(1)(p1)/2\left(\tfrac{-1}{p}\right) = (-1)^{(p-1)/2}, (2p)=1\left(\tfrac{2}{p}\right) = 1 iff p±1(mod8)p \equiv \pm1 \pmod 8, and reciprocity for the rest.

Side note
Diophantine reflexes

Factor (SFFT: xy+ax+by=cxy + ax + by = c becomes (x+b)(y+a)=c+ab(x + b)(y + a) = c + ab); bound (compare growth rates, squeeze between consecutive squares); take mod a small number (squares are 0,1mod40, 1 \bmod 4, cubes 0,±1mod90, \pm1 \bmod 9); descend (Vieta jumping, infinite descent). Nearly every Putnam Diophantine problem yields to one of these four, and knowing which to try first is a matter of pattern practice.

Reminder — Vieta's formulas:r1+r2=ba,r1r2=car_1+r_2=-\frac{b}{a},\qquad r_1 r_2=\frac{c}{a}
Try it
Try it: a valuation

Find the largest kk such that 2k2^k divides (10050)\binom{100}{50}.

Kummer: count carries adding 50+5050 + 50 in base 22. 50=110010250 = 110010_2; doubling a binary number produces one carry per 11-bit, and 5050 has three 11-bits: k=3k = 3. (Legendre confirms: v2(100!)2v2(50!)=97247=3v_2(100!) - 2v_2(50!) = 97 - 2\cdot47 = 3.)

Proofs & Why It Matters

Tip
Proof: lifting the exponent (odd prime case)

For odd prime pp with pabp \mid a - b and pabp \nmid ab: vp(anbn)=vp(ab)+vp(n)v_p(a^n - b^n) = v_p(a - b) + v_p(n).

Two lemmas. (i) If pnp \nmid n then vp(anbn)=vp(ab)v_p(a^n - b^n) = v_p(a - b): since anbn=(ab)an1ibia^n - b^n = (a - b)\sum a^{n-1-i}b^i and the sum is nan1≢0(modp)\equiv na^{n-1} \not\equiv 0 \pmod p. (ii) vp(apbp)=vp(ab)+1v_p(a^p - b^p) = v_p(a - b) + 1: write a=b+kpta = b + kp^t and expand apa^p binomially — the terms beyond the first two carry extra factors of pp, and the (p2)\binom p2 term supplies exactly one more (this is where pp odd is used). Induct on vp(n)v_p(n), peeling off one factor of pp at a time with (ii) and finishing with (i). \blacksquare Significance: LTE is the exact accounting of how a prime divides a difference of powers — it replaces pages of casework in olympiad and Putnam solutions alike.

Tip
Proof: dnφ(d)=n\sum_{d\mid n}\varphi(d) = n

A one-line counting proof of a multiplicative identity.

Sort the fractions 1n,2n,,nn\tfrac1n, \tfrac2n, \ldots, \tfrac nn by their reduced denominator dd (a divisor of nn). Exactly φ(d)\varphi(d) of them reduce to denominator dd (the numerators coprime to dd). Summing over dd counts all nn fractions. \blacksquare Significance: the argument proves more — that the multiplicative group mod pp is cyclic (count elements by order, compare with φ(d)=p1\sum\varphi(d) = p - 1), i.e. primitive roots exist.

Going Deeper: Worked Problems

Example
Worked: an order computation via CRT

Find the order of 33 modulo 10001000.

Step 1 — 1000=81251000 = 8\cdot125; the order mod 10001000 is the lcm of the orders mod 88 and mod 125125.

Step 2 — mod 88: 32=913^2 = 9 \equiv 1, order 22.

Step 3 — mod 125125: φ(125)=100\varphi(125) = 100, so the order divides 100100; test the maximal proper divisors 5050 and 2020. 3201+203^{20} \equiv 1 + 20\cdot\ldots — compute: 35=24373^5 = 243 \equiv -7, 310493^{10} \equiv 49, 320492=24012613^{20} \equiv 49^2 = 2401 \equiv 26 \ne 1; 350=(310)54953^{50} = (3^{10})^5 \equiv 49^5, and 4922649^2 \equiv 26, 494262=6765149^4 \equiv 26^2 = 676 \equiv 51, 4955149=24991149^5 \equiv 51\cdot49 = 2499 \equiv -1 \ne 1. So the order mod 125125 is 100100.

Step 4 — lcm(2,100)=100\mathrm{lcm}(2, 100) = 100. The method: never search; use φ\varphi to list candidates and test only the maximal proper divisors.

Example
Worked: a Diophantine equation by bounding

Find all positive integers nn such that n2+3n+5n^2 + 3n + 5 is a perfect square.

Step 1 — squeeze between consecutive squares: for n1n \ge 1, (n+1)2=n2+2n+1<n2+3n+5(n + 1)^2 = n^2 + 2n + 1 < n^2 + 3n + 5 and (n+2)2=n2+4n+4>n2+3n+5(n + 2)^2 = n^2 + 4n + 4 > n^2 + 3n + 5 iff n>1n > 1.

Step 2 — so for n2n \ge 2 the expression lies strictly between two consecutive squares: never a square.

Step 3 — check n=1n = 1: 1+3+5=9=321 + 3 + 5 = 9 = 3^2 ✓. Answer: only n=1n = 1. Bounding by neighboring squares (or cubes) is the first thing to try on "when is this polynomial a perfect power."