Modular Arithmetic When to Use Use this skill when working on modular-arithmetic problems in graph number theory. Decision Tree 1. Extended Euclidean Algorithm - Find gcd(a,b) and x,y with ax + by = gcd(a,b) - Modular inverse: a^{-1} mod n when gcd(a,n) = 1 - 2. Chinese Remainder Theorem - System x = a i (mod m i) with coprime m i - Unique solution mod prod(m i) - 3. Euler's Theorem - a^{phi(n)} = 1 (mod n) when gcd(a,n) = 1 - phi(p^k) = p^{k-1}(p-1) - 4. Quadratic Residues - Legendre symbol: (a/p) = a^{(p-1)/2} mod p - Quadratic reciprocity: (p/q)(q/p) = (-1)^{...} - Tonelli-Shanks for squar…