Theorem 1.1 (Division Algorithm). For any integers a and b with b>0There exist unique Integers q and r such that a=bq+r with 0≤r<b.
Proof. Consider the set S=a−bk:k∈Z,a−bk≥0. This set is non-empty (by the Archimedean property, choosing k sufficiently negative). By the well-ordering principle, S has a least element r=a−bq. If r≥bThen r−b=a−(q+1)b∈S with r−b<rContradicting minimality. So 0≤r<b. For uniqueness, if a=bq1+r1=bq2+r2Then b(q1−q2)=r2−r1. Since ∣r2−r1∣<bWe must Have q1=q2 and r1=r2. ■
1.2 Divisibility
We write d∣a (read ”d divides a”) if there exists k∈Z with a=dk.
Proposition 1.2. For all a,b,c∈Z:
If a∣b and b∣cThen a∣c.
If a∣b and a∣cThen a∣(mb+nc) for all m,n∈Z.
If a∣b and b=0Then ∣a∣≤∣b∣.
a∣0 for all aBut 0∣a only when a=0.
Proof. (1) a∣b means b=ak and b∣c means c=bℓ=akℓSo a∣c. (2) a∣b means b=ak and a∣c means c=aℓSo mb+nc=a(mk+nℓ). (3) a∣b means b=akSo ∣b∣=∣a∣⋅∣k∣≥∣a∣. (4) 0=a⋅0So a∣0. If 0∣aThen a=0⋅k=0. ■
1.3 Worked Examples of the Division Algorithm
Problem. Apply the division algorithm to write −237=14q+r with 0≤r<14.
Solution
We compute 237÷14=16.93…So 14⋅16=224 and 14⋅17=238>237. Thus for positive 237: q=16, r=13Giving 237=14⋅16+13.
For a=−237: we need q such that r=−237−14q satisfies 0≤r<14. −237=14(−17)+1: check 14⋅(−17)=−238And −238+1=−237. Here q=−17 and r=1 with 0≤1<14. ■
Problem. Find all integers n such that n≡3(mod7) and n≡2(mod5).
Solution
From n≡3(mod7)We have n=7k+3 for some k∈Z. Substituting into n≡2(mod5): 7k+3≡2(mod5)So 7k≡−1≡4(mod5)Giving 2k≡4(mod5)Hence k≡2(mod5).
So k=5m+2And n=7(5m+2)+3=35m+17. The solutions are n≡17(mod35). ■
1.4 Uniqueness of the Greatest Common Divisor
Theorem 1.3. Let a,b∈ZNot both zero. The greatest common divisor of a and b Exists and is unique.
Proof. The set D=d∈N:d∣aandd∣b" is non-empty since ∣a∣∈D (if a=0) or ∣b∣∈D (if b=0). By the well-ordering principle, D has A least element g. We claim g=gcd(a,b). By definition g∣a and g∣b. If c∣a And c∣bThen c≤∣c∣≤g (since g is the least positive common divisor). For Uniqueness: if g1 and g2 are both greatest common divisors, then g1∣g2 and g2∣g1 So g1=g2 (since both are positive). ■ ### 1.5 Least Common Multiple Definition. The least common multiple of positive integers a and bWritten lcm(a,b)Is the smallest positive integer m such that a∣m and b∣m. Theorem 1.4 (GCD—LCM Identity). For all positive integers a and bgcd(a,b)⋅lcm(a,b)=abProof. Write a=∏i=1kpiαi and b=∏i=1kpiβi where αi,βi≥0. Then gcd(a,b)=∏i=1kpimin(αi,βi) and lcm(a,b)=∏i=1kpimax(αi,βi). Since min(αi,βi)+max(αi,βi)=αi+βi for each iWe have gcd(a,b)⋅lcm(a,b)=∏i=1kpiαi+βi=ab■Proposition 1.5. For all positive integers a,b: 1. lcm(a,b)=ab/gcd(a,b). 2. gcd(a,lcm(b,c))=lcm(gcd(a,b),gcd(a,c)). ### 1.6 Worked Example: LCM Computation Problem. Compute lcm(252,105) and verify the gcd—lcm identity.
SolutionFirst, gcd(252,105). Using the Euclidean algorithm: 252=2⋅105+42, 105=2⋅42+21, 42=2⋅21+0. So gcd(252,105)=21. By the identity: lcm(252,105)=252⋅105/21=252⋅5=1260. Verification: 1260/252=5 and 1260/105=12Both integers. ■## 2. The Greatest Common Divisor ### 2.1 Definition and Existence Definition. The greatest common divisor of a and b (not both zero) is the largest Positive integer d such that d∣a and d∣b. We write d=gcd(a,b). Theorem 2.1 (Bézout”s Identity). For any a,b∈Z not both zero, there exist x,y∈Z such that gcd(a,b)=ax+byProof. Let S=ax+by:x,y∈Z,ax+by>0. By the well-ordering principle, S has a least element d=ax0+by0. We show d=gcd(a,b). First, d∣a: write a=dq+r with 0≤r<d. Then r=a−dq=a−(ax0+by0)q=a(1−x0q)+b(−y0q). If r>0Then r∈S with r<dContradicting minimality. So r=0Giving d∣a. Similarly d∣b. For any Common divisor c of a and b: c∣(ax0+by0)=dSo c≤d. ■ ### 2.2 The Euclidean Algorithm To compute gcd(a,b) with a≥b>0: a=bq1+r1,0<r1<bb=r1q2+r2,0<r2<r1⋮rn−1=rnqn+1+0 Then gcd(a,b)=rn. The algorithm terminates because b>r1>r2>⋯≥0. Proposition 2.2.gcd(a,b)=gcd(b,r) where r=amodb. Proof. Write a=bq+r. If d∣a and d∣bThen d∣(a−bq)=r. Conversely, if d∣b and d∣rThen d∣(bq+r)=a. So the set of common Divisors of (a,b) equals the set of common divisors of (b,r)Hence their greatest Common divisors are equal. ■ ### 2.3 The Extended Euclidean Algorithm The extended Euclidean algorithm computes gcd(a,b)and finds integers x,y such that ax+by=gcd(a,b) simultaneously by back-substituting through the Euclidean algorithm steps. Problem. Find gcd(252,105) and express it as a linear combination of 252 and 105.SolutionWe perform the Euclidean algorithm and back-substitute: 252=2⋅105+42⇒42=252−2⋅105105=2⋅42+21⇒21=105−2⋅4242=2⋅21+0 So gcd(252,105)=21. Back-substituting: 21=105−2(252−2⋅105)=105−2⋅252+4⋅105=5⋅105−2⋅252 Verification: 5⋅105−2⋅252=525−504=21. ■Problem. Find integers x,y such that 1073x+313y=gcd(1073,313).SolutionEuclidean algorithm: 1073=3⋅313+134313=2⋅134+45134=2⋅45+4445=1⋅44+144=44⋅1+0 So gcd(1073,313)=1. Back-substituting from 1=45−44: 44=134−2⋅45So 1=45−(134−2⋅45)=3⋅45−13445=313−2⋅134So 1=3(313−2⋅134)−134=3⋅313−7⋅134134=1073−3⋅313So 1=3⋅313−7(1073−3⋅313)=24⋅313−7⋅1073 Therefore x=−7 and y=24: (−7)(1073)+24(313)=−7511+7512=1. ■### 2.4 Coprime Integers Integers a and b are coprime (or relatively prime) if gcd(a,b)=1. Proposition 2.3 (Euclid’s Lemma). If p is prime and p∣abThen p∣a or p∣b. Proof. If p∤aThen gcd(p,a)=1. By Bézout’s identity, 1=px+ay for some x,y∈Z. Multiplying by b: b=pbx+aby. Since p∣abyWe get p∣b. ■Corollary 2.4. If p is prime and p∣a1a2⋯anThen p∣ai for some i. Proposition 2.5. If gcd(a,b)=1 and a∣bcThen a∣c. Proof. Since gcd(a,b)=1By Bézout’s identity there exist x,y with ax+by=1. Multiplying by c: acx+bcy=c. Since a∣bcWe have a∣bcyAnd a∣acx So a∣c. ■Proposition 2.6. If gcd(a,b)=1 and gcd(a,c)=1Then gcd(a,bc)=1. Proof. By Bézout, ax1+by1=1 and ax2+cz2=1. Multiplying: (ax1+by1)(ax2+cz2)=a(ax1x2+x1cz2+by1x2)+(by1)(cz2)=1. This expresses 1 as a linear combination of a and bcSo gcd(a,bc)=1. ■ ## 3. Prime Numbers ### 3.1 The Fundamental Theorem of Arithmetic Theorem 3.1 (Fundamental Theorem of Arithmetic). Every integer n>1 can be written uniquely (including order) as a product of primes: n=p1a1p2a2⋯pkak Where p1<p2<⋯<pk are primes and ai≥1. Proof (existence). Suppose for contradiction that some integer n>1 cannot be factored into Primes. Let n be the smallest such integer. If n is prime, we are done. Otherwise n=ab with 1<a,b<n. By minimality of nBoth a and b factor into primes, so n=ab also Factors into primes, a contradiction. ■Proof (uniqueness). Suppose n=p1⋯pr=q1⋯qs where all pi,qj are prime. Since p1∣q1⋯qsBy Euclid’s lemma (applied inductively), p1∣qj for some j. Since qj is prime, p1=qj. Cancel to get p2⋯pr=q1⋯q^j⋯qs. Continue by induction. ■ ### 3.2 The Infinitude of Primes Theorem 3.2 (Euclid). There are infinitely many primes. Proof. Suppose p1,p2,…,pn is a complete list of all primes. Consider N=p1p2⋯pn+1. Then N>1So by the fundamental theorem, N has a prime divisor p. But p∣N and p∣p1⋯pn implies p∣(N−p1⋯pn)=1Which is Impossible. Contradiction. ■ ### 3.3 The Prime Number Theorem Theorem 3.3 (Prime Number Theorem). Let π(x) denote the number of primes ≤x. Then limx→∞x/lnxπ(x)=1 This tells us that primes thin out as numbers grow larger, with the density near x being Approximately 1/lnx. Proposition 3.3a (Chebyshev estimates). There exist positive constants c1,c2 such that c1lnxx≤π(x)≤c2lnxx For all sufficiently large x. Intuition. Chebyshev proved π(x)=O(x/lnx) and π(x)=Ω(x/lnx) using properties Of the binomial coefficient (n2n). The prime number theorem strengthens this to π(x)∼x/lnx. Proposition 3.3b. For n≥2The n-th prime pn satisfies nlnn<pn<2nlnn. This follows from the prime number theorem and the estimate π(x)∼x/lnx. ### 3.4 Worked Examples of Prime Factorization Problem. Find the prime factorization of N=2016 and determine σ(2016) and τ(2016).Solution2016=2⋅1008=22⋅504=23⋅252=24⋅126=25⋅63=25⋅7⋅9=25⋅32⋅7. So 2016=25⋅32⋅71. τ(2016)=(5+1)(2+1)(1+1)=6⋅3⋅2=36. σ(2016)=2−126−1⋅3−133−1⋅7−172−1=63⋅13⋅8=6552. ■Problem. Prove that 2 is irrational using the fundamental theorem of arithmetic.SolutionSuppose 2=a/b where a,b∈N with gcd(a,b)=1. Then 2b2=a2 So 2∣a2Hence 2∣a. Write a=2c. Then 2b2=4c2So b2=2c2Giving 2∣b2 and hence 2∣b. But then 2∣gcd(a,b)=1Contradiction. ■### 3.5 The Sieve of Eratosthenes The Sieve of Eratosthenes is an ancient algorithm for finding all primes up to a given bound N. Algorithm. Start with the list 2,3,4,…,N. For each prime p≤NMark All multiples of p (starting from p2) as composite. The remaining unmarked numbers are prime. Proposition 3.4. The sieve of Eratosthenes correctly identifies all primes up to N in O(NloglogN) arithmetic operations. Proof. Every composite n≤N has a prime factor p≤n≤N. When the sieve Reaches this prime pIt marks n as composite (since n=p⋅m with m≥pSo n≥p2 and n is a multiple of p at least p2). Conversely, no prime is ever marked since The only multiples of p marked are kp for k≥2. ■Problem. Use the sieve of Eratosthenes to find all primes up to 50.SolutionStart with 2,3,4,…,50. Mark multiples of 2 (from 4): remove 4,6,8,10,…,50. Mark multiples of 3 (from 9): remove 9,12,15,18,…,48. Mark multiples of 5 (from 25): remove 25,30,35,40,45. Mark multiples of 7 (from 49): remove 49. We stop at ⌊50⌋=7. The primes up to 50 are: 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47. ■### 3.6 Bertrand’s Postulate Theorem 3.5 (Bertrand’s Postulate, Chebyshev 1852). For every integer n>1There exists at Least one prime p with n<p<2n. Proof (sketch). Let θ(x)=∑p≤xlnp (Chebyshev’s function). The proof proceeds In three main steps: 1. Show θ(n)<2nln2 for all n≥1 by induction using properties of binomial coefficients. Specifically, (n2n) is divisible by every prime p with n<p≤2n and (n2n)≤4nSo ∏n<p≤2np≤4n. 2. Strengthen the bound to show that if no prime p satisfies n<p≤2nThen θ(2n)=θ(n)Leading to a contradiction with the bound for sufficiently large n. 3. The remaining small values of n are checked directly. ■Remark. This was famously conjectured by Bertrand in 1845 and proved by Chebyshev in 1852. Erdős published an elegant proof in 1932. Problem. Verify Bertrand’s postulate for n=20: find a prime p with 20<p<40.SolutionThe primes in the range (20,40) are: 23,29,31,37. There are four such primes, Confirming the postulate. ■Remark. Bertrand’s postulate has been significantly strengthened. The prime number theorem Implies that for large nThere are approximately n/lnn primes between n and 2n. ## 4. Congruences ### 4.1 Basic Properties We write a≡b(modm) (read ”a is congruent to b modulo m”) if m∣(a−b). Proposition 4.1. Congruence modulo m is an equivalence relation on Z. Proposition 4.2. If a≡b(modm) and c≡d(modm)Then: 1. a+c≡b+d(modm). 2. ac≡bd(modm). 3. an≡bn(modm) for all n≥1. Proposition 4.3. If ac≡bc(modm) and gcd(c,m)=dThen a≡b(modm/d). In particular, if gcd(c,m)=1We can cancel: a≡b(modm). ### 4.2 Solving Linear Congruences Theorem 4.4. The congruence ax≡b(modm) has a solution if and only if gcd(a,m)∣b. When solutions exist, there are exactly gcd(a,m) incongruent solutions Modulo m. Proof.ax≡b(modm) is equivalent to ax−my=b for some y∈Z. By Bézout’s identity, solutions exist iff gcd(a,m)∣b. If d=gcd(a,m) and x0 is one Solution, then x0+k(m/d) for k=0,1,…,d−1 gives d incongruent solutions modulo m. ■ ### 4.3 Worked Example Problem. Solve 14x≡6(mod33). Solution.gcd(14,33)=1So a unique solution exists. Using the extended Euclidean algorithm: 33=2⋅14+5, 14=2⋅5+4, 5=1⋅4+1. Back-substituting: 1=5−4=5−(14−2⋅5)=3⋅5−14=3(33−2⋅14)−14=3⋅33−7⋅14. So 14(−7)≡1(mod33)Giving x≡−42≡24(mod33). ■ ### 4.4 Additional Properties of Congruences Proposition 4.5. For any a,b,m∈Z with m>0: 1. a≡b(modm) if and only if a and b leave the same remainder when divided by m. 2. If a≡b(modm) and d∣mThen a≡b(modd). 3. If a≡b(modmi) for i=1,…,kThen a≡b(modlcm(m1,…,mk)). Proof of (1). Write a=mq1+r1 and b=mq2+r2 with 0≤r1,r2<m. Then a−b=m(q1−q2)+(r1−r2). So m∣(a−b) iff m∣(r1−r2)Which Happens iff r1=r2 (since ∣r1−r2∣<m). ■Proof of (2).m∣(a−b) and d∣mSo d∣(a−b). ■Proof of (3). We have mi∣(a−b) for each iSo lcm(m1,…,mk)∣(a−b) By definition of the lcm. Hence a≡b(modlcm(m1,…,mk)). ■Proposition 4.6. If a≡b(modm) and f(x)=ckxk+⋯+c1x+c0 is a Polynomial with integer coefficients, then f(a)≡f(b)(modm). Proof. By Proposition 4.2, aj≡bj(modm) for all j≥0And cjaj≡cjbj(modm). Summing over j gives the result. ■Corollary 4.6a. If a≡b(modm)Then ak≡bk(modm) for all k≥0. In Particular, the last d digits of a and b (in base 10) determine the last d digits of ak And bk. ### 4.5 More Worked Examples Problem. Solve 12x≡9(mod15).Solutiongcd(12,15)=3And 3∣9So solutions exist. There are exactly 3 incongruent Solutions modulo 15. Divide through by 3: 4x≡3(mod5). Now gcd(4,5)=1So 4x≡3(mod5) Gives x≡4−1⋅3(mod5). Since 4⋅4=16≡1(mod5)We get x≡4⋅3=12≡2(mod5). The solutions modulo 15 are x≡2,7,12(mod15). ■Problem. Find the last two digits of 71947.SolutionWe need 71947mod100. Since ϕ(100)=ϕ(4)ϕ(25)=2⋅20=40 and gcd(7,100)=1Euler’s theorem gives 740≡1(mod100). 1947=48⋅40+27So 71947=(740)48⋅727≡727(mod100). 72=49, 74=2401≡1(mod100). So 727=(74)6⋅73≡16⋅343≡43(mod100). The last two digits of 71947 are 43. ■### 4.6 Wilson’s Theorem Theorem 4.7 (Wilson’s Theorem). An integer p≥2 is prime if and only if (p−1)!≡−1(modp)Proof. (⇒) Suppose p is prime. In (Z/pZ)∗Every element a has a Unique multiplicative inverse a−1. The elements 1 and p−1 are self-inverse since 1⋅1≡1 and (p−1)2=p2−2p+1≡1(modp). For 2≤a≤p−2We have a=a−1 (if a2≡1Then p∣(a−1)(a+1)So p∣(a−1) or p∣(a+1) Giving a≡1 or a≡p−1). Thus the elements 2,3,…,p−2 pair up into (p−3)/2 pairs of mutually inverse elements. The product of all elements in each pair is 1 modulo pSo (p−1)!=1⋅(p−1)∏a=2p−2a≡1⋅(p−1)⋅1(p−3)/2≡−1(modp) (⇐) If n≥2 is composite, then n=ab with 1<a≤b<n. If a=b Both a and b appear in (n−1)!So n∣(n−1)! and (n−1)!≡0(modn). If a=b (i.e., n=a2), then n>4 implies a>2And both a and 2a<a2=n appear in (n−1)!So again (n−1)!≡0(modn). The case n=4 gives 3!=6≡2(mod4)=−1. ■Problem. Use Wilson’s theorem to find 8!mod11.SolutionBy Wilson’s theorem, (11−1)!=10!≡−1(mod11). 10!=10⋅9⋅8!So 10⋅9⋅8!≡−1(mod11). 90≡2(mod11)So 2⋅8!≡−1(mod11). Multiplying by 6 (the inverse of 2 mod 11): 8!≡−6≡5(mod11). ■## 5. The Chinese Remainder Theorem ### 5.1 Statement and Proof Theorem 5.1 (Chinese Remainder Theorem). Let m1,m2,…,mk be pairwise coprime Positive integers. Then for any integers a1,a2,…,akThe system of congruences x≡ai(modmi),i=1,2,…,k Has a unique solution modulo M=m1m2⋯mk. Proof. Let Mi=M/mi. Since gcd(mi,Mi)=1There exist bi with biMi≡1(modmi) (by Bézout). Set x=∑i=1kaibiMi. Then x≡aibiMi≡ai⋅1≡ai(modmi) since Mj≡0(modmi) for j=i. For uniqueness: if x and x′ are both solutions, then x−x′ is divisible by each miHence by MSo x≡x′(modM). ■ ### 5.2 Worked Example Problem. Solve x≡2(mod3), x≡3(mod5), x≡2(mod7). Solution.M=3⋅5⋅7=105. M1=35, M2=21, M3=15. 35⋅2=70≡1(mod3)So b1=2. 21⋅1=21≡1(mod5)So b2=1. 15⋅1=15≡1(mod7)So b3=1. x=2⋅2⋅35+3⋅1⋅21+2⋅1⋅15=140+63+30=233≡23(mod105). Verification: 23=7⋅3+2≡2(mod3). 23=4⋅5+3≡3(mod5). 23=3⋅7+2≡2(mod7). ■ ### 5.3 More Worked Examples Problem. Solve the system: x≡3(mod7), x≡5(mod11), x≡2(mod13).SolutionM=7⋅11⋅13=1001. M1=143. We need 143b1≡1(mod7). Since 143=20⋅7+3We need 3b1≡1(mod7) So b1≡5(mod7). M2=91. We need 91b2≡1(mod11). Since 91=8⋅11+3We need 3b2≡1(mod11) So b2≡4(mod11). M3=77. We need 77b3≡1(mod13). Since 77=5⋅13+12We need 12b3≡1(mod13). 12≡−1(mod13)So −b3≡1Giving b3≡12(mod13). x=3⋅5⋅143+5⋅4⋅91+2⋅12⋅77=2145+1820+1848=5813. 5813mod1001: 5813=5⋅1001+808. So x≡808(mod1001). ■### 5.4 The General Chinese Remainder Theorem The CRT can be extended to systems where the moduli are not necessarily pairwise coprime. Theorem 5.2 (General CRT). The system x≡ai(modmi) for i=1,…,k has a Solution if and only if ai≡aj(modgcd(mi,mj)) for all i,j. When a solution Exists, it is unique modulo lcm(m1,…,mk). Proof. (⇒) If x≡ai(modmi) and x≡aj(modmj)Then mi∣(x−ai) and mj∣(x−aj). Any common divisor of mi and mj divides (x−ai)−(x−aj)=aj−ai. So gcd(mi,mj)∣(ai−aj). (⇐) Proceed pairwise. Consider x≡a1(modm1) and x≡a2(modm2). Write m1=d⋅m1′ and m2=d⋅m2′ where d=gcd(m1,m2). By hypothesis a1≡a2(modd). The combined congruence is equivalent to x≡a2+dk(modm2) for some k with d∣k. By induction on kThe full system Is solvable. Uniqueness modulo the lcm follows from Proposition 4.5(3). ■Problem. Solve x≡3(mod6), x≡5(mod10).Solutiongcd(6,10)=2. Check: 3≡5(mod2)? 3mod2=1, 5mod2=1. Yes, so a Solution exists. x≡3(mod6) means x=6k+3. Substituting: 6k+3≡5(mod10)So 6k≡2(mod10). Dividing by gcd(6,10)=2: 3k≡1(mod5)Giving k≡2(mod5). So k=5m+2And x=6(5m+2)+3=30m+15. The solution is x≡15(mod30). Note lcm(6,10)=30. ■Problem. Determine whether the system x≡5(mod12), x≡3(mod15)x≡8(mod20) has a solution.SolutionCheck pairwise compatibility: gcd(12,15)=3. 5≡3(mod3)? 5mod3=2, 3mod3=0. No! 2=0. Therefore the system has no solution. ■### 5.5 Applications of the CRT Application (RSA decryption). In RSA, one computes mdmodn where n=pq. Since ϕ(n)=(p−1)(q−1)One can compute mdmodp and mdmodq separately (much faster For large moduli) and then combine using the CRT. Application (Constructing integers with prescribed residues). The CRT guarantees that for any Choice of residues ai modulo pairwise coprime miWe can find an integer with all those Residues simultaneously. This is used in error-correcting codes and in the construction of Pseudorandom number generators. Application (Simultaneous systems). The CRT is used to reduce computation modulo a large Number n=m1m2⋯mk to computations modulo each smaller mi. This “garner’s Algorithm” approach is widely used in computer algebra systems. Problem. A number N leaves remainder 3 when divided by 8, 1 when divided by 9And 7 when divided by 25. Find the smallest such N.SolutionM=8⋅9⋅25=1800. M1=225. 225b1≡1(mod8). 225≡1(mod8)So b1=1. M2=200. 200b2≡1(mod9). 200=22⋅9+2So 2b2≡1(mod9), b2=5. M3=72. 72b3≡1(mod25). 72=2⋅25+22So 22b3≡1(mod25). 22≡−3(mod25). We need −3b3≡1So 3b3≡24, b3=8. N=3⋅1⋅225+1⋅5⋅200+7⋅8⋅72=675+1000+4032=5707. 5707mod1800=5707−3⋅1800=5707−5400=307. The smallest positive solution is N=307. ■## 6. Euler’s Theorem and Fermat’s Little Theorem ### 6.1 Euler’s Totient Function Definition. Euler’s totient functionϕ(n) counts the integers in 1,2,…,n That are coprime to n. Proposition 6.1. If p is prime, then ϕ(p)=p−1. ### 6.2 Multiplicativity of the Totient Function Theorem 6.2. If gcd(m,n)=1Then ϕ(mn)=ϕ(m)ϕ(n). Proof. We count the integers in 1,2,…,mn coprime to mn. Since gcd(m,n)=1 We have gcd(k,mn)=1 if and only if gcd(k,m)=1 and gcd(k,n)=1. Consider the m×n grid where entry (i,j) represents the number k≡i(modm)k≡j(modn). By the CRT, each pair (i,j) with 1≤i≤m, 1≤j≤n Corresponds to a unique k modulo mn. The number k is coprime to mn iff i is coprime to m And j is coprime to n. There are ϕ(m) choices for i and ϕ(n) choices for j Giving ϕ(m)⋅ϕ(n) values of k coprime to mn. ■Proposition 6.3. If n=p1a1⋯pkakThen ϕ(n)=n∏p∣n(1−1/p). Proof. By multiplicativity, ϕ(n)=∏i=1kϕ(piai). Now ϕ(pa)=pa−pa−1=pa(1−1/p)Since exactly pa−1 of the pa integers in 1,…,pa are multiples of p. ■ ### 6.3 Euler’s Theorem Theorem 6.4 (Euler’s Theorem). If gcd(a,n)=1Then aϕ(n)≡1(modn)Proof. Let Un=r1,r2,…,rϕ(n) be the reduced residue system modulo n. Since gcd(a,n)=1The map ri↦ari(modn) permutes Un. Thus ∏i=1ϕ(n)(ari)≡∏i=1ϕ(n)ri(modn)So aϕ(n)∏ri≡∏ri(modn). Since gcd(∏ri,n)=1We cancel to get aϕ(n)≡1(modn). ■Corollary 6.5 (Fermat’s Little Theorem). If p is prime and gcd(a,p)=1Then ap−1≡1(modp). Equivalently, ap≡a(modp) for all a. ### 6.4 Worked Examples Problem. Compute 7222mod15. Solution.ϕ(15)=ϕ(3)ϕ(5)=2⋅4=8. Since gcd(7,15)=178≡1(mod15). We have 222=27⋅8+6So 7222=(78)27⋅76≡127⋅76(mod15). Now 72=49≡4(mod15), 74≡16≡1(mod15)So 76=74⋅72≡1⋅4=4(mod15). ■Problem. Show that n13−n is divisible by 2730 for all n∈Z.Solution2730=2⋅3⋅5⋅7⋅13. We show n13≡n(modp) for each prime p∈2,3,5,7,13. For p=13: by Fermat, n13≡n(mod13). For p∈2,3,5,7: by Fermat, np≡n(modp). Since p<13By repeated Application n13=nqp+r=(np)q⋅nr≡nq⋅nr=nq+r. Iterating gives n13≡n(modp). By the CRT (since 2,3,5,7,13 are pairwise coprime), n13≡n(mod2730)So 2730∣(n13−n). ■### 6.5a Fermat Pseudoprimes Definition. A composite integer n is a Fermat pseudoprime to base a if an−1≡1(modn). A composite integer that is a Fermat pseudoprime to all bases a with gcd(a,n)=1 is a Carmichael number. The existence of Carmichael numbers shows that Fermat’s little theorem is a necessary but not Sufficient test for primality. The smallest Carmichael number is 561=3⋅11⋅17. Problem. Verify that 561 is a Fermat pseudoprime to base 2.Solution2560mod561. Since 561=3⋅11⋅17Compute modulo each factor: 22≡1(mod3)So 2560=(22)280≡1(mod3). 210≡1(mod11) (Fermat), and 560=56⋅10So 2560≡1(mod11). 216≡1(mod17) (Fermat), and 560=35⋅16So 2560≡1(mod17). By the CRT, 2560≡1(mod561). Since 561 is composite, it is a Fermat pseudoprime To base 2. ■### 6.5 Application to RSA The RSA cryptosystem is a direct application of Euler’s theorem. Setup. Choose two large distinct primes p and q. Set n=pq and ϕ(n)=(p−1)(q−1). Choose e with 1<e<ϕ(n) and gcd(e,ϕ(n))=1. Compute d such that ed≡1(modϕ(n)) using the extended Euclidean algorithm. Public key:(n,e). Private key:(n,d). Encryption: To send message m (0≤m<n), compute c=memodn. Decryption: Compute m=cdmodn. Theorem 6.6. RSA decryption is correct: cd≡m(modn). Proof. Since ed≡1(modϕ(n))Write ed=1+kϕ(n) for some k∈Z. If gcd(m,n)=1Then cd≡med=m1+kϕ(n)≡m⋅(mϕ(n))k≡m⋅1k≡m(modn) by Euler’s theorem. If gcd(m,n)>1Then since n=pqWe have p∣m or q∣m. Suppose p∣m And q∤m. By Fermat, mq−1≡1(modq). So med=m1+k(p−1)(q−1)≡m(modq). Also med≡0≡m(modp). By the CRT, med≡m(modn). ■Problem. Given p=61, q=53, e=17Encrypt and decrypt the message m=65.Solutionn=61⋅53=3233, ϕ(n)=60⋅52=3120. Find d: solve 17d≡1(mod3120). Using the extended Euclidean algorithm: 3120=183⋅17+9, 17=1⋅9+8, 9=1⋅8+1. Back-substituting: 1=9−8=9−(17−9)=2⋅9−17=2(3120−183⋅17)−17=2⋅3120−367⋅17. So d≡−367≡2753(mod3120). Encrypt: c=6517mod3233. Compute: 652=4225≡992(mod3233). 654≡9922=984064≡1232(mod3233). 658≡12322=1517824≡1547(mod3233). 6516≡15472=2393209≡789(mod3233). 6517=6516⋅65≡789⋅65=51285≡2790(mod3233). So c=2790. Decrypt: m=27902753mod3233. (By the correctness proof, this returns 65.) ■## 7. Primitive Roots ### 7.1 The Multiplicative Order Definition. The multiplicative order of a modulo n (where gcd(a,n)=1) is the Smallest positive integer k such that ak≡1(modn). We write ordn(a)=k. Proposition 7.1.ordn(a) divides ϕ(n). Proposition 7.2.ak≡1(modn) if and only if ordn(a)∣k. Proposition 7.3. If ordn(a)=kThen ordn(am)=k/gcd(k,m). ### 7.2 Primitive Roots Definition.g is a primitive root modulo n if ordn(g)=ϕ(n)I.e., g Generates the multiplicative group (Z/nZ)∗. Theorem 7.4. A primitive root modulo n exists if and only if n=2, n=4, n=pkOr n=2pk where p is an odd prime and k≥1. Intuition. The multiplicative group (Z/nZ)∗ is cyclic precisely for these Values of n. When the group is not cyclic (e.g., n=8 where (Z/8Z)∗≅C2×C2), no single element can generate the entire group. Proposition 7.4a.(Z/nZ)∗≅∏i=1k(Z/piaiZ)∗ Where n=∏piai is the prime factorization. Each factor (Z/paZ)∗ is cyclic for odd primes p. This decomposition explains why primitive roots exist only for the stated values: a product of Cyclic groups is cyclic if and only if the orders are pairwise coprime. Theorem 7.5. If n has a primitive root, then there are exactly ϕ(ϕ(n)) primitive roots Modulo n. ### 7.3 Existence of Primitive Roots for Primes Theorem 7.6. Every prime p has a primitive root. Proof. Let ψ(d) denote the number of elements of (Z/pZ)∗ of order Exactly d. The key facts are: 1. ψ(d)≤ϕ(d) for all d∣(p−1). 2. ∑d∣(p−1)ψ(d)=p−1=∑d∣(p−1)ϕ(d). If ψ(d)<ϕ(d) for some dThen the sum ∑ψ(d) would be strictly less than ∑ϕ(d)=p−1A contradiction. So ψ(d)=ϕ(d) for all d∣(p−1). In Particular, ψ(p−1)=ϕ(p−1)>0So primitive roots exist. ■ ### 7.4 Finding Primitive Roots To test whether g is a primitive root modulo p (where p is prime), it suffices to verify g(p−1)/q≡1(modp) for every prime divisor q of p−1. Proposition 7.7. Let p be prime and g∈(Z/pZ)∗. Then g is a primitive Root modulo p if and only if for every prime q∣(p−1), g(p−1)/q≡1(modp). Proof. If g is a primitive root, ordp(g)=p−1. If g(p−1)/q≡1(modp) For some prime q∣(p−1)Then ordp(g)∣(p−1)/q<p−1Contradiction. Conversely, if g is not a primitive root, let d=ordp(g)<p−1. Then d∣(p−1) So (p−1)/d>1 has some prime factor qMeaning q∣(p−1) and d∣(p−1)/q. Then g(p−1)/q≡1(modp)Contradicting the hypothesis. ■Problem. Find all primitive roots modulo 13.Solutionϕ(13)=12. We need elements of order 12 in (Z/13Z)∗. The prime divisors of 12 are 2 and 3. We test g6 and g4. g=2: 24=16≡3≡1, 26=64≡12≡−1≡1(mod13). So 2 is a primitive root. g=3: 34=81≡3(mod13). Not a primitive root (order divides 4). g=5: 54=625≡1(mod13). Not a primitive root. g=6: 64≡9, 66≡12≡−1(mod13). Primitive root. g=7: 74≡9, 76≡12≡−1(mod13). Primitive root. g=11: 114≡3, 116≡12≡−1(mod13). Primitive root. By Theorem 7.5, there are ϕ(12)=4 primitive roots modulo 13: 2,6,7,11. ■### 7.5 Index Calculus When a primitive root g modulo p is known, every element a of (Z/pZ)∗ Can be written uniquely as a≡gk(modp) with 0≤k<p−1. The exponent k Is called the index (or discrete logarithm) of a to base gWritten indg(a)=k. Proposition 7.8 (Properties of indices). Let g be a primitive root modulo p. For all a,b∈(Z/pZ)∗: 1. indg(ab)≡indg(a)+indg(b)(modp−1). 2. indg(ak)≡k⋅indg(a)(modp−1). 3. indg(1)=0 and indg(g)=1. ### 7.6 The Discrete Logarithm Problem Definition. Given a prime pA primitive root g modulo pAnd a∈(Z/pZ)∗ The discrete logarithm problem (DLP) asks: find k such that gk≡a(modp). Unlike ordinary logarithms, no polynomial-time algorithm is known for the DLP. The best known Algorithms (baby-step giant-step, index calculus, number field sieve) run in subexponential time. Application (Diffie—Hellman key exchange). Alice and Bob agree on a large prime p and Primitive root g (public). Alice chooses secret aSends gamodp. Bob chooses secret b Sends gbmodp. The shared secret is gabmodpComputable by Alice as (gb)a and By Bob as (ga)b. An eavesdropper seeing ga and gb cannot efficiently compute gab Without solving the DLP. ### 7.7 Worked Example: Index Calculus Problem. Let g=2 be a primitive root modulo 19. Find ind2(14)(mod19).SolutionFirst, verify 2 is a primitive root modulo 19: ϕ(19)=18Prime factors of 18 are 2 and 3. 218/2=29=512. 512/19=26.9…, 26⋅19=494, 512−494=18≡−1(mod19). 218/3=26=64. 64/19=3.4…, 64−57=7≡1(mod19). Confirmed. Compute powers of 2 modulo 19: 21=2, 22=4, 23=8, 24=16≡−3, 25=32≡13≡−626=64≡7, 27=14, 28=28≡9, 29=18≡−1210≡−2≡17, 211≡−4≡15, 212≡−8≡11213≡−16≡3, 214=6, 215=12, 216=24≡5217=10, 218=20≡1. From 27=14(mod19)We get ind2(14)=7. ■Problem. Using the index table above, solve 6x≡11(mod19).SolutionTaking indices base 2: ind2(6x)=ind2(11). x⋅ind2(6)≡ind2(11)(mod18). From the table: ind2(6)=14 and ind2(11)=12. So 14x≡12(mod18). gcd(14,18)=2 and 2∣12So solutions exist. Divide by 2: 7x≡6(mod9). 7−1≡4(mod9) (since 7⋅4=28≡1). So x≡4⋅6=24≡6(mod9). The solutions modulo 18 are x≡6,15(mod18). Check: 66=46656. 46656/19=2455.6…, 2455⋅19=46645, 46656−46645=11. ■## 8. Quadratic Residues ### 8.1 Definition Definition. Let p be an odd prime. An integer a not divisible by p is a quadratic Residue modulo p if the congruence x2≡a(modp) has a solution. Otherwise a is a quadratic non-residue. Proposition 8.1. There are exactly (p−1)/2 quadratic residues and (p−1)/2 quadratic Non-residues modulo p. Proof. The map x↦x2(modp) from 1,2,…,p−1 to the set of quadratic Residues is exactly two-to-one since x2≡(−x)2(modp) but x≡−x(modp) for x≡0(modp) (since p is odd). ■ ### 8.2 Euler’s Criterion Theorem 8.2 (Euler’s Criterion). Let p be an odd prime and gcd(a,p)=1. Then a(p−1)/2≡{1(modp)−1(modp)ifaisaQRmodpifaisaQNRmodpProof. By Fermat’s little theorem, ap−1≡1(modp)So (a(p−1)/2−1)(a(p−1)/2+1)≡0(modp). Thus a(p−1)/2≡±1(modp). If a is a QR, say a≡x2(modp)Then a(p−1)/2≡xp−1≡1(modp). For the converse: a(p−1)/2≡1(modp) implies a is a QR (by a polynomial argument: the Equation x(p−1)/2−1≡0(modp) has at most (p−1)/2 solutions, and all QRs are Solutions). Since there are exactly (p−1)/2 QRs and (p−1)/2 elements with a(p−1)/2≡1(modp)These sets coincide. ■ ### 8.3 The Legendre Symbol Definition. The Legendre symbol is defined by (pa)=⎩⎨⎧01−1ifp∣aifaisaQRmodpifaisaQNRmodpProposition 8.3. The Legendre symbol is completely multiplicative: (pab)=(pa)(pb). ### 8.4 Quadratic Reciprocity Theorem 8.4 (Law of Quadratic Reciprocity). For distinct odd primes p and q: (qp)(pq)=(−1)2p−1⋅2q−1Theorem 8.5 (First Supplement).(p−1)=(−1)(p−1)/2. So −1 is a QR Mod p if and only if p≡1(mod4). Theorem 8.6 (Second Supplement).(p2)=(−1)(p2−1)/8. So 2 is a QR Mod p if and only if p≡±1(mod8). ### 8.5 Proofs of the Supplements Proof of the First Supplement. By Euler’s criterion: (p−1)=(−1)(p−1)/2. This equals 1 when p≡1(mod4) (since (p−1)/2 is even) and −1 when p≡3(mod4) (since (p−1)/2 is odd). ■Proof of the Second Supplement. By Euler’s criterion, (p2)=2(p−1)/2(modp). Consider the product P=∏k=1(p−1)/22k=2(p−1)/2⋅((p−1)/2)!. Reduce each 2k modulo p into the set −(p−1)/2,…,−1,1,…,(p−1)/2. The key observation (Gauss’s lemma) is that the number of 2k landing in the negative range is (p2−1)/8Which depends on pmod8. ■ ### 8.6 The Jacobi Symbol Definition. The Jacobi symbol generalizes the Legendre symbol to odd composite moduli. For n=p1a1⋯pkak (odd, positive): (na)=∏i=1k(pia)aiWarning.(na)=1 does not imply a is a QR modulo n when n is Composite. The Jacobi symbol satisfies the same reciprocity law and supplements as the Legendre symbol, making It efficient for computation. Proposition 8.7 (Properties of the Jacobi symbol). For odd positive m,n: 1. (mna)=(ma)(na). 2. (nab)=(na)(nb). 3. (nm)(mn)=(−1)2m−1⋅2n−1. 4. (n−1)=(−1)(n−1)/2. 5. (n2)=(−1)(n2−1)/8. 6. If a≡b(modn)Then (na)=(nb). ### 8.7 Worked Examples Problem. Determine whether 73 is a quadratic residue modulo 97. Solution. By quadratic reciprocity, since both 73 and 97 are congruent to 1(mod4): (9773)=(7397)=(7324)=(734)(736)=1⋅(736)(736)=(732)(733)(732)=1 since 73≡1(mod8). (733)=(−1)23−1⋅273−1(373)=(−1)72(31)=1⋅1=1. So (9773)=1And 73 is a QR modulo 97. ■Problem. Compute the Jacobi symbol (383219).SolutionBoth 219=3⋅73 and 383 are odd. Since 383≡3(mod4) and 219≡3(mod4) By reciprocity: (383219)=−(219383). 383mod219=164. So (219383)=(219164)=(2194)(21941)=(21941). 41≡1(mod4), 219≡3(mod4)So (21941)=−(41219). 219mod41=14. So (41219)=(4114)=(412)(417). (412)=1 since 41≡1(mod8). 7≡3(mod4), 41≡1(mod4)So (417)=(741)=(76)=(72)(73). (72)=1 since 7≡−1(mod8). (73)=(−1)1⋅3(37)=−(31)=−1. Working back: (417)=1⋅(−1)=−1. (41219)=1⋅(−1)=−1. (21941)=−(−1)=1. (219383)=1. (383219)=−(1)=−1. So 219 is a QNR modulo 383. ■### 8.8 Applications of Quadratic Reciprocity Application (Solovay—Strassen primality test). For an odd candidate nChoose random a and Check whether a(n−1)/2≡(na)(modn) (where the Jacobi symbol is used). If n is composite, at least half of all a violate this. This gives a probabilistic primality test. Application (determining solvability). Quadratic reciprocity allows efficient computation of Legendre symbols without directly checking all residues, reducing an O(p) problem to O(logp) arithmetic operations. ### 8.9 Computing Square Roots Modulo p When a is a quadratic residue modulo an odd prime pFinding x with x2≡a(modp) Is the square root problem modulo p. Proposition 8.8. When p≡3(mod4)A square root of a modulo p (when a is a QR) is Given by x≡±a(p+1)/4(modp). Proof.(a(p+1)/4)2=a(p+1)/2=a⋅a(p−1)/2≡a⋅1=a(modp) by Euler’s criterion. ■Problem. Find a square root of 5 modulo 29.SolutionFirst verify 5 is a QR modulo 29: (295)=(529)=(54)=1. Yes. Since 29≡1(mod4)We cannot use the simple formula. We use a direct search among The QRs modulo 29. The squares modulo 29 of 1,2,…,14 are: 1,4,9,16,25,36≡7,49≡20,64≡6,81≡23,100≡13121≡5,144≡28,169≡24,196≡22. So 112=121≡5(mod29). A square root of 5 modulo 29 is x≡11 (and also x≡18). ■Problem. Find a square root of 7 modulo 19.Solution19≡3(mod4)So we can use the formula. First verify 7 is a QR: (197)=(−1)27−1⋅219−1(719)=(−1)54(75)=(75). (75)=(−1)2⋅3(57)=(52)=(−1)(25−1)/8=(−1)3=−1. Wait, let me recompute. (197): 7≡3(mod4), 19≡3(mod4)So (197)=−(719)=−(75). Now 5≡1(mod4), 7≡3(mod4) So (75)=−(57)=−(52)=−(−1)=1. So (197)=−1. This means 7 is a QNR modulo 19So no square root exists. ■## 9. Continued Fractions ### 9.1 Simple Continued Fractions A simple continued fraction is an expression of the form a0+a1+a2+a3+⋯111 Where a0∈Z and a1,a2,…∈N. We write [a0;a1,a2,…]. ### 9.2 Computation For an irrational number αThe continued fraction expansion is computed recursively: a0=⌊α⌋, α1=1/(α−a0), a1=⌊α1⌋And So on. Example.2=1+(2−1)=1+2+11=1+2+(2−1)1. So 2=[1;2,2,2,…]=[1;2]. ### 9.3 Convergents The n-th convergentpn/qn=[a0;a1,…,an] is computed by: p−1=1,p0=a0,pn=anpn−1+pn−2q−1=0,q0=1,qn=anqn−1+qn−2Theorem 9.1.∣pn/qn−α∣<1/qn2 for all n. Theorem 9.2 (Best Approximation). If ∣qα−p∣<∣qnα−pn∣ for q<qn+1Then p/q=pn/qn. ### 9.4 Periodic Continued Fractions Theorem 9.3 (Lagrange). The continued fraction of α is periodic if and only if α Is a quadratic irrational. Example. The golden ratio φ=21+5=[1;1,1,1,…]=[1;1]. ### 9.5 More Computation Examples Problem. Find the continued fraction expansion of 7.Solution7=2+(7−2)So a0=2. α1=7−21=37+2. So a1=1. α2=7−13=27+1. So a2=1. α3=7−12=37+1. So a3=1. α4=7−23=7+2. So a4=4. α5=7−21=α1. The process repeats. Therefore 7=[2;1,1,1,4]. ■Problem. Compute the convergents of [1;1,1,1,1] (the first five terms of φ).Solutionp−1=1, p0=1. q−1=0, q0=1. a1=1: p1=1⋅1+1=2, q1=1⋅1+0=1. Convergent: 2/1=2. a2=1: p2=1⋅2+1=3, q2=1⋅1+1=2. Convergent: 3/2=1.5. a3=1: p3=1⋅3+2=5, q3=1⋅2+1=3. Convergent: 5/3≈1.667. a4=1: p4=1⋅5+3=8, q4=1⋅3+2=5. Convergent: 8/5=1.6. These are ratios of consecutive Fibonacci numbers, converging to φ≈1.618. ■Problem. Find the continued fraction expansion of the rational number 157/68.Solution157/68=2+21/68So a0=2. 68/21=3+5/21So a1=3. 21/5=4+1/5So a2=4. 5/1=5So a3=5. Therefore 157/68=[2;3,4,5]. Verification: [2;3,4,5]=2+3+4+1/511=2+3+5/211=2+68/211=2+21/68=157/68. ■### 9.6 Periodic Continued Fractions and Pell’s Equation The continued fraction expansion of D is closely connected to Pell’s equation x2−Dy2=1. Theorem 9.4. If the continued fraction of D has period length ℓThen: - If ℓ is even, the fundamental solution of x2−Dy2=1 is (pℓ−1,qℓ−1). - If ℓ is odd, the fundamental solution is (p2ℓ−1,q2ℓ−1). ### 9.7 Approximation Properties Theorem 9.5. If p/q is a convergent to αThen α−qp<q21 Furthermore, if ∣α−p/q∣<1/(2q2)Then p/q must be a convergent to α. Proposition 9.6. The convergents pn/qn satisfy qn≥Fn+1 (the (n+1)-th Fibonacci Number), so the denominators grow at least exponentially. ### 9.8 Irrationality via Continued Fractions Theorem 9.7. If α has an infinite continued fraction expansion, then α is irrational. Proof. If α were rational, the Euclidean algorithm would terminate in finitely many Steps, producing a finite continued fraction. Contradiction. ■Proposition 9.8.e is irrational. Proof. The continued fraction of e is [2;1,2,1,1,4,1,1,6,1,1,8,1,…] Which has a regular but infinite pattern. By Theorem 9.7, e is irrational. ■ ## 10. Diophantine Equations ### 10.1 Linear Diophantine Equations Theorem 10.1. The equation ax+by=c has integer solutions if and only if gcd(a,b)∣c. Proof. This follows directly from Bézout’s identity. ■Proposition 10.1a. If d=gcd(a,b) and (x0,y0) is a particular solution of ax+by=c Then all integer solutions are given by x=x0+db⋅t,y=y0−da⋅t,t∈ZProblem. Find all integer solutions to 15x+21y=12.Solutiond=gcd(15,21)=3 and 3∣12So solutions exist. Divide through by 3: 5x+7y=4. Using the extended Euclidean algorithm: 7=1⋅5+2, 5=2⋅2+1. So 1=5−2⋅2=5−2(7−5)=3⋅5−2⋅7. Thus 5(3)+7(−2)=1And 5(12)+7(−8)=4. A particular solution: (x0,y0)=(12,−8). All solutions: x=12+7t, y=−8−5tFor t∈Z. ■### 10.2 Pythagorean Triples Theorem 10.2. All primitive Pythagorean triples (a,b,c) (with gcd(a,b,c)=1 and a2+b2=c2) are given by a=m2−n2,b=2mn,c=m2+n2 Where m>n>0, gcd(m,n)=1And m≡n(mod2). Proof. Without loss, a is odd and b is even. From a2=c2−b2=(c−b)(c+b). Setting m=(c+a)/2 and n=(c−a)/2 yields the parameterization. ■Proposition 10.2a. The number of primitive Pythagorean triples with hypotenuse ≤N is Asymptotically 2πN. Problem. Find all primitive Pythagorean triples with c≤50.SolutionWe need m>n>0, gcd(m,n)=1, m≡n(mod2)And c=m2+n2≤50. Try m values: m2≤49So m≤7. m=2: n=1: (3,4,5). m=3: n=2: (5,12,13). m=4: n=1: (15,8,17). n=3: gcd(4,3)=1, (7,24,25). m=5: n=2: (21,20,29). n=4: (9,40,41). m=6: n=1: gcd(6,1)=1, (35,12,37). n=5: (11,60,61) but c>50. m=7: n=2: (45,28,53) but c>50. n=4: (33,56,65) but c>50. n=6: gcd(7,6)=1, (13,84,85) but c>50. Primitive triples with c≤50: (3,4,5), (5,12,13), (15,8,17), (7,24,25), (21,20,29), (9,40,41), (35,12,37). ■### 10.3 Pell’s Equation Theorem 10.3. The equation x2−Dy2=1 (where D is not a perfect square) always has Non-trivial integer solutions. If (x1,y1) is the smallest positive solution, then all solutions Are given by (xn+ynD)=(x1+y1D)n. Proof. The existence of a non-trivial solution follows from Dirichlet’s unit theorem applied to Z[D]. The general solution follows from the fact that the group of units of norm 1 in Z[D] is cyclic and generated by the fundamental unit. ■Problem. Find all solutions to x2−2y2=1.SolutionThe continued fraction of 2=[1;2] has period ℓ=1 (odd). The first convergent after p0/q0=1/1 is p1/q1=3/2. Check: 32−2⋅22=9−8=1. The fundamental solution is (x1,y1)=(3,2). All solutions are given by (3+22)n=xn+yn2. n=1: (3,2). n=2: (17,12). n=3: (99,70). n=4: (577,408). ■Problem. Find the fundamental solution to x2−3y2=1.Solution3=[1;1,2]Period ℓ=2 (even). Convergents: p0/q0=1/1, p1/q1=2/1. a2=2: p2=2⋅2+1=5, q2=2⋅1+1=3. Since ℓ=2 is even, the fundamental solution is (pℓ−1,qℓ−1)=(p1,q1)=(2,1). Check: 22−3⋅12=4−3=1. Confirmed. All solutions: (2+3)n=xn+yn3. n=1: (2,1). n=2: (7,4). n=3: (26,15). n=4: (97,56). ■### 10.4 The Method of Descent Theorem 10.4. The equation x4+y4=z2 has no non-trivial integer solutions. Proof (sketch). Assume a minimal solution (x,y,z) with z>0 minimal. Then (x2,y2,z) Is a Pythagorean triple. Using the parameterization of Pythagorean triples and infinite descent, one Constructs a smaller solution, contradicting minimality. ■Corollary 10.5. The equation x4+y4=z4 has no non-trivial integer solutions (this is Fermat’s last theorem for n=4). ### 10.5 The Generalized Riemann Hypothesis Conjecture (Generalized Riemann Hypothesis). All non-trivial zeros of the Dirichlet L-function L(s,χ) for any Dirichlet character χ lie on the line Re(s)=1/2. This is one of the most important open problems in mathematics. It has profound implications for the Distribution of primes in arithmetic progressions and the error terms in various number-theoretic Estimates. ## 11. Algebraic Number Theory: Gaussian Integers ### 11.1 The Gaussian Integers Definition. The Gaussian integers are Z[i]=a+bi:a,b∈Z Where i=−1. They form a commutative ring with unity under the usual addition and Multiplication of complex numbers. ### 11.2 Norm and Units The norm of α=a+bi∈Z[i] is N(α)=a2+b2=ααˉ. Proposition 11.1.N(αβ)=N(α)N(β). Proposition 11.2. The units of Z[i] are 1,−1,i,−i (exactly those with norm 1). ### 11.3 Primes in Gaussian Integers Theorem 11.3. An element π∈Z[i] is prime if and only if one of the following Holds: 1. π=u(1+i) for some unit u (up to associates, π=1+iWith norm 2). 2. π=u(a+bi) where a2+b2=p for a prime p≡1(mod4). 3. π=up where p≡3(mod4) is a prime in Z. Proof. If N(π)=p where p≡1(mod4) is prime, then π is Gaussian prime. If p≡3(mod4)Then p is Gaussian prime (since p=(a+bi)(c+di) would give p2=N(p)=(a2+b2)(c2+d2)Forcing one factor to have norm 1A unit). The prime 2=(1+i)(1−i)=(1+i)2⋅(−i)So 1+i is Gaussian prime with norm 2. ■Corollary 11.4 (Fermat’s Theorem on Sums of Two Squares). A prime p can be written as a sum of Two squares if and only if p=2 or p≡1(mod4). Proof. For p≡1(mod4): by quadratic reciprocity, −1 is a QR mod pSo a2≡−1(modp) for some a. Then p∣(a2+1)=(a+i)(a−i) in Z[i]. If p were prime in Z[i]It would divide a+i or a−iBut neither quotient is in Z[i]. So p=αβ with neither a unit, giving p2=N(p)=N(α)N(β) So N(α)=N(β)=pI.e., p=a2+b2. ■ ### 11.4 The Gaussian Integers Form a UFD Theorem 11.5.Z[i] is a Euclidean domain (with norm as the Euclidean function), hence A PID, hence a UFD. Proof. For α,β∈Z[i] with β=0Write α/β=s+ti With s,t∈Q. Choose m,n∈Z with ∣s−m∣≤1/2 and ∣t−n∣≤1/2. Set q=m+ni and r=α−βq. Then r∈Z[i] and N(r)=N(β)⋅N(α/β−q)=N(β)((s−m)2+(t−n)2)≤N(β)⋅1/2<N(β). So Z[i] is Euclidean. ■ ### 11.5 Worked Example Problem. Factor 5 in Z[i]. Solution.N(5)=25. We need a2+b2=5Which gives (a,b)=(1,2) or (2,1). So 5=(1+2i)(1−2i)=(2+i)(2−i). Note that 1+2i and 2−i differ by a unit: 1+2i=−i(2−i). So up to associates, 5=(2+i)(2−i). ■Problem. Factor 13 in Z[i] and verify that 13=a2+b2.SolutionSince 13≡1(mod4)It factors in Z[i]. We need a2+b2=13 with a,b∈Z. Trying: a2≤13So a∈0,1,2,3. a=2: b2=9, b=3. So 13=22+32=(2+3i)(2−3i). Verification: (2+3i)(2−3i)=4+9=13. Both 2+3i and 2−3i are Gaussian primes Since N(2+3i)=13 is prime. ■### 11.6 Associates and Irreducibility Definition. Two Gaussian integers α,β are associates if α=uβ for some Unit u∈1,−1,i,−i. Associates have the same norm. Proposition 11.6. A Gaussian integer α is irreducible if and only if N(α) is either A prime in Z or the square of a prime in Z. Proof. If N(α)=p (prime in Z) and α=βγThen N(α)=N(β)N(γ)=pSo one of N(β),N(γ) equals 1Making that Factor a unit. Conversely, if α is irreducible, then N(α) has no nontrivial Factorizations compatible with factorizations of α. ■Problem. Determine whether the following Gaussian integers are irreducible: 3+4i, 6+7i, 2+5i.Solution3+4i: N(3+4i)=9+16=25=52. This is a square of a prime, so 3+4i may or may Not be irreducible. In fact, (2+i)2=4+4i+i2=3+4iSo 3+4i is reducible. 6+7i: N(6+7i)=36+49=85=5⋅17. Neither 5 nor 17 is a square of a prime, And N(6+7i) is not prime. We check if 6+7i has a proper factor. If 6+7i=(a+bi)(c+di) With N(a+bi)=5Then a2+b2=5Giving (a,b)=(1,2) or (2,1). Check: (1+2i)(2+3i)=2+3i+4i+6i2=−4+7i=6+7i. (1+2i)(3+2i)=3+2i+6i+4i2=−1+8i. (2+i)(3+4i)=6+8i+3i+4i2=2+11i. (2+i)(4+3i)=8+6i+4i+3i2=5+10i. (1+2i)(4+3i)=4+3i+8i+6i2=−2+11i. None match, so 6+7i is irreducible. 2+5i: N(2+5i)=4+25=29Which is prime. So 2+5i is irreducible. ■### 11.7 Division in Gaussian Integers Proposition 11.7. If α,β∈Z[i] with β=0Then there exist κ,ρ∈Z[i] such that α=βκ+ρ with N(ρ)<N(β). This is the Euclidean algorithm for Z[i] (proved in Theorem 11.5). Problem. Divide 11+3i by 4−i in Z[i]Finding quotient and remainder.Solution4−i11+3i=(4−i)(4+i)(11+3i)(4+i)=1744+11i+12i+3i2=1741+23i=1741+1723i. Round: κ=2+1i=2+i. ρ=(11+3i)−(4−i)(2+i)=(11+3i)−(8+4i−2i−i2)=(11+3i)−(9+2i)=2+i. Check: N(ρ)=N(2+i)=5<N(4−i)=17. ■## 12. Arithmetic Functions ### 12.1 Multiplicative Functions Definition. An arithmetic function f:N→C is multiplicative if f(mn)=f(m)f(n) whenever gcd(m,n)=1. It is completely multiplicative if f(mn)=f(m)f(n) for all m,n. Proposition 12.1. If f is multiplicative and n=p1a1⋯pkakThen f(n)=f(p1a1)⋯f(pkak). Example.ϕ(n) is multiplicative (but not completely multiplicative). ϕ(6)=2=ϕ(2)ϕ(2)=1. ### 12.2 The Sum-of-Divisors Function Definition.σ(n)=∑d∣nd (the sum of all positive divisors of n). τ(n)=∑d∣n1 (the number of positive divisors of n). Proposition 12.2. If n=p1a1⋯pkakThen σ(n)=∏i=1kpi−1piai+1−1,τ(n)=∏i=1k(ai+1)Proof. Both σ and τ are multiplicative (since the divisor structure of mn with gcd(m,n)=1 factors as the product of the divisor structures of m and n). So it suffices To verify the formula for prime powers. For n=pa: the divisors are 1,p,p2,…,paGiving σ(pa)=1+p+p2+⋯+pa=p−1pa+1−1,τ(pa)=a+1 The general formula follows from multiplicativity. ■Definition.n is perfect if σ(n)=2n. Theorem 12.3 (Euclid—Euler). An even number n is perfect if and only if n=2p−1(2p−1) Where 2p−1 is a Mersenne prime. Proof. If n=2p−1(2p−1) with 2p−1 prime, then σ(n)=σ(2p−1)σ(2p−1)=(2p−1)⋅2p=2n. Conversely, if n is even And perfect, write n=2p−1m with m odd. Then σ(n)=(2p−1)σ(m)=2pmSo σ(m)=2pm/(2p−1). Since σ(m) must be an integer, (2p−1)∣m. Write m=(2p−1)q. Then σ(m)=2pqBut also σ(m)≥m+1=(2p−1)q+1. If q>1Then σ(m)≥m+1+q>2pq Contradiction. So q=1 and m=2p−1 is prime. ■ ### 12.3 The Möbius Function Definition. The Möbius functionμ:N→−1,0,1 is defined by: - μ(1)=1. - μ(n)=0 if n is divisible by a square of a prime (n is not squarefree). - μ(n)=(−1)k if n is a product of kdistinct primes. Proposition 12.4 (Properties of μ). 1. μ is multiplicative: if gcd(m,n)=1Then μ(mn)=μ(m)μ(n). 2. ∑d∣nμ(d)=1 if n=1 and 0 if n>1. Proof of (2). If n=1: ∑d∣1μ(d)=μ(1)=1. If n>1Write n=p1a1⋯pkak. By multiplicativity, ∑d∣nμ(d)=∏i=1k∑j=0aiμ(pij). For each factor: ∑j=0aiμ(pij)=μ(1)+μ(pi)+μ(pi2)+⋯=1+(−1)+0+⋯=0 Since ai≥1. ■ ### 12.4 Dirichlet Convolution Definition. The Dirichlet convolution of two arithmetic functions f and g is (f∗g)(n)=∑d∣nf(d)⋅g(dn)Proposition 12.5 (Properties of Dirichlet convolution). 1. Commutativity:f∗g=g∗f. 2. Associativity:(f∗g)∗h=f∗(g∗h). 3. Identity element: The function ε(n)={10n=1n>1 satisfies f∗ε=f. 4. Möbius inversion:μ is the convolution inverse of 1 (where 1(n)=1 for all n), i.e., 1∗μ=ε. Proof of (1).(f∗g)(n)=∑d∣nf(d)g(n/d). Setting e=n/dThis equals ∑e∣nf(n/e)g(e)=(g∗f)(n). ■ ### 12.5 Möbius Inversion Theorem 12.6 (Möbius Inversion). If f(n)=∑d∣ng(d) for all n≥1Then g(n)=∑d∣nμ(d)f(n/d)Proof. In terms of Dirichlet convolution: f=g∗1So f∗μ=(g∗1)∗μ=g∗(1∗μ)=g∗ε=g. The explicit form Follows by writing out the convolution: ∑d∣nμ(d)f(n/d)=∑d∣nμ(d)∑e∣(n/d)g(e)=∑e∣ng(e)∑d∣(n/e)μ(d). The inner sum is 1 if e=n and 0 otherwise, so only g(n) remains. ■ ### 12.6 Euler’s Totient Summation Formula Proposition 12.7.∑k=1nϕ(k)=π23n2+O(nlogn). Intuition. The probability that two random integers are coprime is 1/ζ(2)=6/π2. The Number of pairs (a,b) with 1≤a≤b≤n and gcd(a,b)=1 is ∑b=1nϕ(b)Which should be approximately 21⋅π26n2=π23n2. ### 12.7 Worked Examples Problem. Express ∑d∣nϕ(d) in closed form. Solution. Let f(n)=∑d∣nϕ(d). We claim f(n)=n. Since ϕ is multiplicative, f is multiplicative. For n=pa: f(pa)=∑j=0aϕ(pj)=ϕ(1)+ϕ(p)+⋯+ϕ(pa)=1+(p−1)+(p2−p)+⋯+(pa−pa−1)=pa. So f(n)=n. This can also be proved directly: the integers 1,2,…,n are partitioned by Their gcd with nAnd the number with gcd(k,n)=d is ϕ(n/d). ■Problem. Use Möbius inversion to find a formula for ϕ(n) in terms of the divisors of n.SolutionWe know ∑d∣nϕ(d)=n. By Möbius inversion: ϕ(n)=∑d∣nμ(d)⋅dn=n∑d∣ndμ(d)=n∏p∣n(1−p1) The last equality uses the multiplicative property of μ: the sum ∑d∣nμ(d)/d factors Over prime powers as ∏p∣n(1−1/p). ■Problem. Compute ∑d∣60μ(d)⋅σ(60/d).Solution60=22⋅3⋅5. The divisors of 60 are 1,2,3,4,5,6,10,12,15,20,30,60. μ is nonzero only for squarefree divisors: μ(1)=1, μ(2)=−1, μ(3)=−1, μ(5)=−1, μ(6)=1, μ(10)=1, μ(15)=1, μ(30)=−1. σ(60)=168, σ(30)=72, σ(20)=42, σ(15)=24σ(12)=28, σ(10)=18, σ(6)=12, σ(1)=1. ∑d∣60μ(d)σ(60/d)=1⋅168+(−1)⋅72+(−1)⋅42+(−1)⋅24+1⋅28+1⋅18+1⋅12+(−1)⋅1=168−72−42−24+28+18+12−1=87. This computes the Dirichlet convolution (μ∗σ)(60). ■### 12.8 Perfect Numbers and Amicable Numbers Definition. Two positive integers m and n are amicable (or friendly) if σ(m)=σ(n)=m+n. The pair (m,n) is called an amicable pair. Example.(220,284) is the smallest amicable pair: σ(220)=σ(22)σ(5)σ(11)=7⋅6⋅12=504=220+284. σ(284)=σ(4)σ(71)=7⋅72=504=220+284. Proposition 12.9. If m and n form an amicable pair, then mσ(m)=nσ(n). Problem. Show that (1184,1210) is an amicable pair.Solution1184=25⋅37. σ(1184)=σ(32)σ(37)=63⋅38=2394. 1210=2⋅5⋅112. σ(1210)=σ(2)σ(5)σ(121)=3⋅6⋅133=2394. 1184+1210=2394=σ(1184)=σ(1210). Confirmed: (1184,1210) is amicable. ■### 12.9 Ramanujan’s Tau Function Definition.Ramanujan’s tau functionτ(n) (not to be confused with the divisor-counting Function) is defined by the identity ∑n=1∞τ(n)qn=q∏n=1∞(1−qn)24Proposition 12.10 (Ramanujan’s congruences). For all n≥1: 1. τ(5n)≡τ(n)(mod5) 2. τ(7n)≡τ(n)(mod7) 3. τ(11n)≡τ(n)(mod11) These congruences were conjectured by Ramanujan in 1916 and proved by Mordell in 1917. They Were later explained by Deligne’s proof of the Weil conjectures. ## 13. Additional Topics ### 13.1 Wilson’s Theorem Theorem 13.1 (Wilson’s Theorem).p is prime if and only if (p−1)!≡−1(modp). Proof. If p is prime: in Z/pZEach element pairs with its inverse. The only Self-inverse elements are 1 and p−1. So (p−1)!≡1⋅(p−1)≡−1(modp). Conversely, if n is composite and n>4Then (n−1)!≡0(modn) since n has a proper Factor appearing in (n−1)!. ■ ### 13.2 The Ring Z/nZTheorem 13.2. The ring Z/nZ is a field if and only if n is prime. Proposition 13.3.(Z/nZ)∗ has order ϕ(n) and is a group under Multiplication. ### 13.3 Dirichlet’s Theorem on Primes in Arithmetic Progressions Theorem 13.4 (Dirichlet). If gcd(a,m)=1Then there are infinitely many primes of the form a+km (k≥0). Proof (sketch). Dirichlet introduced L-functions L(s,χ)=∑n=1∞χ(n)/ns Where χ is a Dirichlet character mod m. The key steps are: 1. L(s,χ0) has a simple pole at s=1 (where χ0 is the principal character). 2. L(1,χ)=0 for non-principal characters χ. 3. logL(s,χ0)=∑plog(1−χ0(p)/ps)−1=∑p∑k≥1χ0(pk)/(kpks). 4. Combining over all characters: ∑χlogL(s,χ) diverges as s→1+And the contribution from χ0 captures primes p≡a(modm). ■ ### 13.4 The Frobenius Coin Problem Theorem 13.5 (Frobenius). If gcd(a,b)=1 and a,b are positive, then the largest integer That cannot be expressed as ax+by with x,y≥0 is ab−a−b. Proof. First, we show every integer n≥ab can be written as ax+by with x,y≥0. Since gcd(a,b)=1The set 0,a,2a,…,(b−1)a is a complete residue system modulo b. So for any n≥0There exists x with 0≤x≤b−1 and ax≡n(modb)Meaning n−ax=by for some integer y. When n≥(b−1)aWe have by=n−ax≥0So y≥0. Thus all n≥(b−1)a=ab−a are representable. To show ab−a−b is not representable: if ab−a−b=ax+by with x,y≥0Then ab=a(x+1)+b(y+1)So b∣a(x+1)Hence b∣(x+1) (since gcd(a,b)=1). So x+1≥bGiving ax≥a(b−1)=ab−a. Then by=ab−a−b−ax≤ab−a−b−(ab−a)=−b<0 Contradicting y≥0. ■Problem. What is the largest amount of postage that cannot be made using 6-cent and 11-cent stamps?Solutiongcd(6,11)=1. By the Frobenius theorem, the largest non-representable amount is 6⋅11−6−11=66−17=49 cents. Verification: 49=6x+11y requires y odd (since 49−11y must be even). y=1: 38/6 (no). y=3: 16/6 (no). y=5: −6/6 (negative). So 49 is indeed not representable. 50=6⋅4+11⋅2, 51=6⋅5+11⋅1, 52=6⋅7+11⋅0. All Values 50 and above are representable. ■### 13.5 The Carmichael Function Definition. The Carmichael functionλ(n) is the smallest positive integer such that aλ(n)≡1(modn) for all a with gcd(a,n)=1. For n=p1a1⋯pkak: λ(n)=lcm(λ(p1a1),…,λ(pkak)) Where λ(2)=1, λ(4)=2, λ(2k)=2k−2 for k≥3And λ(pk)=(p−1)pk−1 for odd primes p. Proposition 13.6.λ(n)∣ϕ(n) for all n≥1And λ(n)=ϕ(n) precisely When n=1,2,4, n=pkOr n=2pk (where p is an odd prime). Intuition. The Carmichael function gives the exponent of the group (Z/nZ)∗ Which equals the lcm of the orders of all elements. Euler’s totient ϕ(n) gives the order of The group. The exponent always divides the order, with equality exactly when the group is cyclic (i.e., when a primitive root exists). Theorem 13.7 (Korselt’s Criterion).n is a Carmichael number (composite n with an−1≡1(modn) for all gcd(a,n)=1) if and only if: 1. n is squarefree, and 2. For every prime p∣n, (p−1)∣(n−1). Proof. If n is squarefree with n=p1⋯pkThen λ(n)=lcm(p1−1,…,pk−1). We need λ(n)∣(n−1)Which is equivalent to each (pi−1)∣(n−1). ■Example.561=3⋅11⋅17. Check: 3−1=2∣560, 11−1=10∣56017−1=16∣560. So 561 is a Carmichael number (the smallest). ### 13.6 Sophie Germain Primes Definition. A prime p is a Sophie Germain prime if 2p+1 is also prime. The prime q=2p+1 is called a safe prime. Sophie Germain primes arise in the study of Fermat’s last theorem: if p is a Sophie Germain prime, then there are no non-zero integer solutions to xp+yp=zp with p∤xyz (this was proved by Sophie Germain). Proposition 13.8. If q=2p+1 is a safe prime and a is a quadratic residue modulo q Then ap≡1(modq). Proof. By Euler’s criterion, a(q−1)/2=ap≡1(modq). ■ The first few Sophie Germain primes are: 2,3,5,11,23,29,41,53,83,89,113,… It is conjectured (but not proved) that there are infinitely many Sophie Germain primes. ### 13.7 Mersenne and Fermat Primes Definition. A Mersenne prime is a prime of the form Mp=2p−1 where p is prime. A Fermat prime is a prime of the form Fn=22n+1. Proposition 13.9. If 2p−1 is prime, then p is prime. Proof. If p=ab with a,b>1Then 2p−1=(2a)b−1=(2a−1)(2a(b−1)+⋯+2a+1) Which is composite. ■Proposition 13.10. If 22n+1 is prime, then n is a power of 2. Proof. If n=ab with b odd, then 22n+1=(22a)2n−a+1And we can factor x2k+1=(x2k−1+1)2−2x2k−1Which allows induction. ■ The known Fermat primes are F0=3, F1=5, F2=17, F3=257, F4=65537. No others are known, and it is conjectured that these are the only ones. ## 14. Additional Results ### 14.1 Fermat’s Last Theorem Theorem 14.1 (Wiles, 1995). For n≥3The equation xn+yn=zn has no non-zero Integer solutions. The proof is far beyond our scope, using deep results from algebraic geometry (elliptic curves, Modular forms, Galois representations). ### 14.1a The Twin Prime Conjecture Conjecture (Twin Prime Conjecture). There are infinitely many primes p such that p+2 Is also prime. The largest known twin prime pair (as of 2026) contains numbers with over 400,000 digits. In 2013, Yitang Zhang proved that there exists some constant N<7×107 such that infinitely many Prime pairs (p,p+N) exist. This bound has since been improved to N≤246 by the Polymath project. Theorem 14.1a (Brun, 1919). The sum of the reciprocals of the twin primes converges: ∑pprimep+2prime(p1+p+21)<∞ This is known as Brun’s theorem. It establishes that the twin primes form a “thin” set, In contrast to the full set of primes (whose reciprocal sum diverges by Euler). ### 14.2 The Ring Z[−5]Example. In Z[−5]Unique factorization fails: 6=2⋅3=(1+−5)(1−−5) The elements 2,3,1+−5,1−−5 are all irreducible but not prime (in the Ring-theoretic sense). This failure of unique factorization motivates the development of ideal Theory. ### 14.3 Quadratic Forms Definition. A binary quadratic form is Q(x,y)=ax2+bxy+cy2 with a,b,c∈Z. Its discriminant is D=b2−4ac. Two forms are equivalent if one can be obtained from the other by a change of variables (x,y)↦(px+qy,rx+sy) with ps−qr=1. Theorem 14.2 (Gauss). The number of equivalence classes of binary quadratic forms of Discriminant D<0 is finite. The class number h(D) is 1 precisely for D∈{−3,−4,−7,−8,−11,−19,−43,−67,−163}. Remark. The fact that −163 is the largest such D was conjectured by Gauss and proved by Heegner in 1952 (with later simplified proofs by Stark and Baker). This is the celebrated class number 1 problem. Proposition 14.2a. A binary quadratic form Q(x,y)=ax2+bxy+cy2 of discriminant D<0 represents n if and only if D is a quadratic residue modulo 4n. ### 14.4 The Class Number and Unique Factorization The class group of a quadratic field Q(D) measures the failure of unique Factorization in its ring of integers. The class numberh(D) is the order of this group. Theorem 14.3. Unique factorization holds in the ring of integers of Q(D) If and only if h(D)=1. This connects the algebraic question of unique factorization to the analytic properties of the Dedekind zeta function, via the class number formula: h(D)=2π∣D∣⋅L(1,χD) Where L(s,χD) is the Dirichlet L-function associated to the quadratic character χD. Proposition 14.3a. The class number h(−D) grows roughly as D for large D: h(−D)∼πD⋅L(1,χ−D) as D→∞. ### 14.5 Mersenne Numbers Theorem 14.4 (Lucas—Lehmer test). Let Mp=2p−1 with p an odd prime. Define the sequence L0=4, Ln+1=Ln2−2. Then Mp is prime if and only if Lp−2≡0(modMp). This test makes it possible to efficiently determine the primality of Mersenne numbers, which is Why the largest known primes are Mersenne primes. Proposition 14.4a. Every even perfect number is a Mersenne prime times a power of 2. This is the Euclid—Euler theorem (Theorem 12.3) restated in terms of Mersenne primes. Problem. Use the Lucas—Lehmer test to verify that M5=31 is prime.SolutionM5=25−1=31. We need L5−2=L3≡0(mod31). L0=4L1=42−2=14L2=142−2=194. 194=6⋅31+8So L2≡8(mod31). L3=82−2=62≡0(mod31). Since L3≡0(mod31), M5=31 is prime. ■### 14.6 The abc Conjecture Conjecture (Masser—Oesterlé, 1985). For every ε>0There exists Kε>0 Such that for all coprime positive integers a,b,c with a+b=c: c<Kε⋅rad(abc)1+ε Where rad(n)=∏p∣np is the radical of n (the product of distinct prime Factors). The abc conjecture is one of the most important open problems in number theory. It implies: - Fermat’s last theorem for sufficiently large exponents. - Mordell’s conjecture (Faltings’ theorem). - Roth’s theorem on Diophantine approximation. - The existence of infinitely many non-Wieferich primes. ### 14.7 The Collatz Conjecture Conjecture (Collatz, 1937). Define T:N→N by T(n)={n/23n+1nevennodd For every positive integer nThe sequence n,T(n),T(T(n)),… eventually reaches 1. Despite its simple statement, the Collatz conjecture remains open. It has been verified by computer For all starting values up to at least 268But no general proof exists. ### 14.8 Worked Example Problem. Determine all representations of n=7 as a sum of two squares. Solution. We need a2+b2=7 with a,b∈Z. Checking: a2≤7So a∈0,1,2. For a=0: b2=7 (no). For a=1: b2=6 (no). For a=2: b2=3 (no). By symmetry, a=−1,−2 give the same. So 7 cannot be written as a sum of two Squares. This is consistent with the theorem: 7≡3(mod4)So it is not a sum of two squares. ■ ### 14.9 Worked Example: Quadratic Forms Problem. Determine the number of representations of n=65 as a sum of two squares.Solution65=5⋅13. Both 5≡1(mod4) and 13≡1(mod4)So both are sums of two Squares: 5=12+22 and 13=22+32. By the identity (a2+b2)(c2+d2)=(ac−bd)2+(ad+bc)2=(ac+bd)2+(ad−bc)2: Using 5=12+22 and 13=22+32: (1⋅2−2⋅3)2+(1⋅3+2⋅2)2=(−4)2+72=16+49=65. (1⋅2+2⋅3)2+(1⋅3−2⋅2)2=82+(−1)2=64+1=65. Also 65=82+12=72+42. Including signs and order, the representations are (±1,±8), (±4,±7), (±7,±4), (±8,±1)Giving 16 ordered pairs. ■## 15. Common Pitfalls :::caution Common Pitfall The Chinese Remainder Theorem requires the moduli to be pairwise coprime. If m1 and m2 share a common factor dThe system x≡a1(modm1)x≡a2(modm2) is solvable only if a1≡a2(modd). ::: :::caution Common Pitfall (na)=1 for the Jacobi symbol does NOT mean a is A QR modulo n. For example, (152)=(32)(52)=(−1)(−1)=1But x2≡2(mod15) has no solution (checking mod 3: x2≡2(mod3) is impossible). ::: :::caution Common Pitfall When using Fermat’s little theorem, remember that ap−1≡1(modp) only when gcd(a,p)=1. The correct form for all a is ap≡a(modp). ::: :::caution Common Pitfall Not every prime in Z remains prime in Z[i]. Only Primes p≡3(mod4) remain prime in Z[i]. Primes p≡1(mod4) factor as p=(a+bi)(a−bi)And 2=(1+i)2⋅(−i). ::: :::caution Common Pitfall The Euclidean algorithm computes gcd(a,b) for positive integers. When Working with negative integers or polynomials, remember that gcd is defined up to a unit (sign For integers, leading coefficient for polynomials). ::: :::caution Common Pitfall When solving ax≡b(modm)You must first check that gcd(a,m)∣b. If not, there is no solution. If gcd(a,m)=d>1Divide through by d And remember that the modulus becomes m/d. ::: :::caution Common Pitfall Primitive roots do not exist for all moduli. A primitive root modulo n Exists only for n=2, n=4, n=pkOr n=2pk where p is an odd prime. For example, There is no primitive root modulo 8 or modulo 15. ::: :::caution Common Pitfall In the division algorithm a=bq+rThe remainder satisfies 0≤r<b when b>0. When a is negative, the quotient q is also negative (or zero). For example, −17=5⋅(−4)+3Not −17=5⋅(−3)+(−2). ::: :::caution Common Pitfall The Möbius function μ(n)=0 when n has a repeated prime factor. Only squarefree integers have nonzero Möbius function values. When using Möbius inversion, many Terms in the sum may be zero. ::: :::caution Common Pitfall Euler’s theorem requires gcd(a,n)=1. To compute akmodn When gcd(a,n)=1Factor out common prime factors first, or use the CRT to work modulo Prime power factors of n separately.