Number Theory
572 words
3 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Number Theory ## 🎯 Learning Objectives - Apply divisibility rules and the division algorithm - Use the **Euclidean algorithm** to find GCD - Compute with **modular arithmetic** - Prove properties of primes - Understand the **Fundamental Theorem of Arithmetic** * * * ## 7.1 Divisibility $a \mid b$ means $b = a \cd...

Number Theory
🎯 Learning Objectives
- Apply divisibility rules and the division algorithm
- Use the Euclidean algorithm to find GCD
- Compute with modular arithmetic
- Prove properties of primes
- Understand the Fundamental Theorem of Arithmetic
7.1 Divisibility
a∣b means b=a⋅k for some integer k.
Properties:
- If a∣b and b∣c, then a∣c (transitive)
- If a∣b and a∣c, then a∣(b+c) and a∣(b−c)
- If a∣b, then a∣bc for any integer c
Division Algorithm
For any integers a>0 and b, there exist unique integers q (quotient) and r (remainder) with 0≤r<a such that b=qa+r.
7.2 GCD and Euclidean Algorithm
gcd(a,b) is the largest integer dividing both a and b.
Euclidean Algorithm:
- a=q1b+r1 (0≤r1<b)
- b=q2r1+r2 (0≤r2<r1)
- r1=q3r2+r3
- Continue until remainder = 0. The last non-zero remainder is gcd(a,b).
Example: gcd(1071,462)
- 1071=2×462+147
- 462=3×147+21
- 147=7×21+0
- gcd(1071,462)=21
7.3 Modular Arithmetic
a≡b(modn) means n∣(a−b).
Properties:
- If a≡b(modn) and c≡d(modn), then a+c≡b+d(modn) and ac≡bd(modn)
- a≡b(modn)⟹ak≡bk(modn)
Application: Divisibility Tests
A number is divisible by 9 iff the sum of its digits is divisible by 9 — because 10≡1(mod9).
7.4 Prime Numbers
A prime p is an integer >1 with no positive divisors other than 1 and p.
Fundamental Theorem of Arithmetic
Every integer n≥2 can be written uniquely as a product of primes (up to order).
Infinitely Many Primes (Euclid's Proof)
Assume finite list p1,…,pk. N=p1p2⋯pk+1 is either prime (contradiction) or has a prime factor not in the list. Contradiction.
✅ Practice Questions
Q1: Find gcd(123,45) using Euclidean algorithm.
Solution123=2×45+33 45=1×33+12 33=2×12+9 12=1×9+3 9=3×3+0 gcd(123,45)=3 Q2: Compute 7100(mod5). Solution7≡2(mod5), so 7100≡2100(mod5). 24=16≡1(mod5). 2100=(24)25≡125=1(mod5). So 7100≡1(mod5). Q3: Prove that if p is prime and p∣ab, then p∣a or p∣b (Euclid's lemma). SolutionAssume p prime, p∣ab, and p∤a. Then gcd(a,p)=1 (since p is prime, its only divisors are 1 and p). By Bézout's identity, there exist integers x,y such that ax+py=1. Multiply by b: abx+pby=b. Since p∣ab, p∣abx, and p∣pby, so p∣b. Join Discord PreviousRelations and FunctionsNextModular Arithmetic Deep