PROJECTENGRAM

[HO] NUMBER THEORY

Number Theory (Integers and Division)

Tags: #◇Problem Solving #◇Number Theory #◇Discrete Math #◇CCDSTRU #◇M9 #◇Cryptography


◇Important Formulas & Core Concepts

Number theory investigates the properties of integers Z\mathbb{Z}, with fundamental applications across cryptography (RSA, Diffie-Hellman), hashing algorithms, and pseudo-random number generation.

1. Division & Modular Arithmetic

  • Divisibility (a∣ba \mid b): For a,b∈Za, b \in \mathbb{Z} with a≠0a \ne 0, aa divides bb if and only if there exists an integer cc such that b=a⋅cb = a \cdot c.
  • The Division Algorithm: For integer aa and positive integer dd, there exist unique integers qq (quotient) and rr (remainder) such that:
    a=d⋅q+r,where 0≤r<da = d \cdot q + r, \quad \text{where } 0 \le r < d
  • Modular Congruence: Integers aa and bb are congruent modulo mm (m∈Z+m \in \mathbb{Z}^+), written a≡b(modm)a \equiv b \pmod m, if and only if m∣(a−b)m \mid (a - b).
    • Equivalently: a mod m=b mod ma \bmod m = b \bmod m, or a=b+k⋅ma = b + k \cdot m for some k∈Zk \in \mathbb{Z}.

2. Primes, GCD, & Fundamental Theorem of Arithmetic

  • Prime Number: An integer p>1p > 1 whose only positive divisors are 11 and pp.
  • Fundamental Theorem of Arithmetic: Every integer n>1n > 1 can be expressed uniquely as a product of prime numbers in non-decreasing order:
    n=p1a1p2a2…pkakn = p_1^{a_1} p_2^{a_2} \dots p_k^{a_k}
  • Greatest Common Divisor (gcd⁡(a,b)\gcd(a, b)): The largest positive integer dividing both aa and bb. If gcd⁡(a,b)=1\gcd(a, b) = 1, aa and bb are relatively prime (coprime).
  • Least Common Multiple (lcm⁡(a,b)\operatorname{lcm}(a, b)): Smallest positive integer divisible by both aa and bb.
    gcd⁡(a,b)⋅lcm⁡(a,b)=a⋅b(for a,b>0)\gcd(a, b) \cdot \operatorname{lcm}(a, b) = a \cdot b \quad (\text{for } a, b > 0)

3. Bézout's Identity & Modular Inverses

  • Bézout's Theorem: For non-zero integers aa and bb, there exist integers ss and tt (Bézout coefficients) such that:
    s⋅a+t⋅b=gcd⁡(a,b)s \cdot a + t \cdot b = \gcd(a, b)
  • Modular Multiplicative Inverse: An integer aˉ\bar{a} is the modular inverse of aa modulo mm if:
    a⋅aˉ≡1(modm)a \cdot \bar{a} \equiv 1 \pmod m
    The inverse aˉ(modm)\bar{a} \pmod m exists if and only if gcd⁡(a,m)=1\gcd(a, m) = 1.

◇Stepped Algorithmic Traces & Calculations

Calculation 1: Extended Euclidean Algorithm & Modular Inverse

Problem: Find gcd⁡(43,17)\gcd(43, 17) and compute the modular inverse of 17(mod43)17 \pmod{43}.

Step 1: Forward Euclidean Division

  1. 43=2⋅17+9  ⟹  9=43−2(17)43 = 2 \cdot 17 + 9 \implies 9 = 43 - 2(17)
  2. 17=1⋅9+8  ⟹  8=17−1(9)17 = 1 \cdot 9 + 8 \implies 8 = 17 - 1(9)
  3. 9=1⋅8+1  ⟹  1=9−1(8)9 = 1 \cdot 8 + 1 \implies 1 = 9 - 1(8)
  4. 8=8⋅1+08 = 8 \cdot 1 + 0 (Remainder 0; last non-zero remainder is 1)
    Thus, gcd⁡(43,17)=1\gcd(43, 17) = 1, confirming that 1717 is invertible modulo 4343.

Step 2: Extended Back-Substitution for Bézout Coefficients

Express the remainder 11 in terms of 4343 and 1717:
1=9−1(8)=9−1[17−1(9)]=2(9)−1(17)=2[43−2(17)]−1(17)=2(43)−4(17)−1(17)1=2(43)−5(17)\begin{aligned} 1 &= 9 - 1(8) \\ &= 9 - 1[17 - 1(9)] = 2(9) - 1(17) \\ &= 2[43 - 2(17)] - 1(17) = 2(43) - 4(17) - 1(17) \\ 1 &= 2(43) - 5(17) \end{aligned}
Hence, Bézout's Identity is:
2(43)+(−5)(17)=12(43) + (-5)(17) = 1

Step 3: Extract Modular Inverse

Reducing modulo 4343:
(−5)⋅17≡1(mod43)(-5) \cdot 17 \equiv 1 \pmod{43}
Because the coefficient −5-5 is negative, add 4343 to find the canonical representative in [0,42][0, 42]:
aˉ≡−5+43=38(mod43)\bar{a} \equiv -5 + 43 = \mathbf{38} \pmod{43}
Verification: 17×38=64617 \times 38 = 646. Notice 646=15×43+1≡1(mod43)646 = 15 \times 43 + 1 \equiv 1 \pmod{43}. Correct!


Calculation 2: Solving a Linear Congruence

Problem: Solve the linear congruence 7x≡3(mod19)7x \equiv 3 \pmod{19}.

Step 1: Find Inverse of 7 Modulo 19

Since gcd⁡(7,19)=1\gcd(7, 19) = 1, an inverse exists. Use Euclidean algorithm:

  • 19=2(7)+5  ⟹  5=19−2(7)19 = 2(7) + 5 \implies 5 = 19 - 2(7)
  • 7=1(5)+2  ⟹  2=7−1(5)7 = 1(5) + 2 \implies 2 = 7 - 1(5)
  • 5=2(2)+1  ⟹  1=5−2(2)5 = 2(2) + 1 \implies 1 = 5 - 2(2)
    Back-substitute:
    1=5−2[7−1(5)]=3(5)−2(7)=3[19−2(7)]−2(7)=3(19)−8(7)1 = 5 - 2[7 - 1(5)] = 3(5) - 2(7) = 3[19 - 2(7)] - 2(7) = 3(19) - 8(7)
    Thus, (−8)⋅7≡1(mod19)  ⟹  7−1≡−8+19=11(mod19)(-8) \cdot 7 \equiv 1 \pmod{19} \implies 7^{-1} \equiv -8 + 19 = 11 \pmod{19}.

Step 2: Multiply Both Sides by the Inverse

x≡11⋅3(mod19)x \equiv 11 \cdot 3 \pmod{19}
x≡33≡33−19=14(mod19)x \equiv 33 \equiv 33 - 19 = \mathbf{14} \pmod{19}
Verification: 7(14)=987(14) = 98. And 98=5(19)+3≡3(mod19)98 = 5(19) + 3 \equiv 3 \pmod{19}. Solution is unique modulo 19: x≡14(mod19)x \equiv 14 \pmod{19}.


Calculation 3: Chinese Remainder Theorem (CRT)

Problem: Find the smallest non-negative integer xx satisfying the system:
x≡2(mod3),x≡3(mod5),x≡2(mod7)x \equiv 2 \pmod 3, \quad x \equiv 3 \pmod 5, \quad x \equiv 2 \pmod 7

Step 1: Verify Pairwise Coprimality

The moduli m1=3,m2=5,m3=7m_1 = 3, m_2 = 5, m_3 = 7 are pairwise coprime (gcd⁡(3,5)=gcd⁡(3,7)=gcd⁡(5,7)=1\gcd(3, 5) = \gcd(3, 7) = \gcd(5, 7) = 1).
Compute product of moduli:
M=m1⋅m2⋅m3=3×5×7=105M = m_1 \cdot m_2 \cdot m_3 = 3 \times 5 \times 7 = 105

Step 2: Compute Partial Moduli & Their Inverses

  1. For m1=3m_1 = 3:
    M1=1053=35M_1 = \frac{105}{3} = 35
    Find y1y_1 such that 35y1≡1(mod3)  ⟹  2y1≡1(mod3)  ⟹  y1=235 y_1 \equiv 1 \pmod 3 \implies 2 y_1 \equiv 1 \pmod 3 \implies y_1 = 2.
  2. For m2=5m_2 = 5:
    M2=1055=21M_2 = \frac{105}{5} = 21
    Find y2y_2 such that 21y2≡1(mod5)  ⟹  1y2≡1(mod5)  ⟹  y2=121 y_2 \equiv 1 \pmod 5 \implies 1 y_2 \equiv 1 \pmod 5 \implies y_2 = 1.
  3. For m3=7m_3 = 7:
    M3=1057=15M_3 = \frac{105}{7} = 15
    Find y3y_3 such that 15y3≡1(mod7)  ⟹  1y3≡1(mod7)  ⟹  y3=115 y_3 \equiv 1 \pmod 7 \implies 1 y_3 \equiv 1 \pmod 7 \implies y_3 = 1.

Step 3: Compute Linear Combination

x=∑i=13aiMiyi(modM)x = \sum_{i=1}^3 a_i M_i y_i \pmod M
x=(2×35×2)+(3×21×1)+(2×15×1)x = (2 \times 35 \times 2) + (3 \times 21 \times 1) + (2 \times 15 \times 1)
x=140+63+30=233x = 140 + 63 + 30 = 233
Reduce modulo 105105:
x≡233 mod 105=233−2(105)=233−210=23x \equiv 233 \bmod 105 = 233 - 2(105) = 233 - 210 = \mathbf{23}

Step 4: Verification

  • 23=7(3)+2≡2(mod3)23 = 7(3) + 2 \equiv 2 \pmod 3
  • 23=4(5)+3≡3(mod5)23 = 4(5) + 3 \equiv 3 \pmod 5
  • 23=3(7)+2≡2(mod7)23 = 3(7) + 2 \equiv 2 \pmod 7
    The unique solution modulo 105 is x=23x = \mathbf{23}.

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

Under what necessary and sufficient condition does an integer aa have a modular multiplicative inverse modulo mm?

Q2

What does Bézout's Identity state for non-zero integers aa and bb?

Q3

In the Chinese Remainder Theorem, what condition must the set of moduli {m1,m2,…,mk}\{m_1, m_2, \dots, m_k\} satisfy?

Q4

If gcd⁡(a,b)=12\gcd(a, b) = 12 and lcm⁡(a,b)=360\operatorname{lcm}(a, b) = 360, what is the product a⋅ba \cdot b?

Q5

What is the modular multiplicative inverse of 1717 modulo 4343?

Q6

If a≡b(modm)a \equiv b \pmod m and c≡d(modm)c \equiv d \pmod m, which of the following operations is NOT universally valid?

Q7

When testing whether n=101n = 101 is prime using trial division, what is the largest prime divisor that needs to be tested?

Q8

What is the solution to 7x≡3(mod19)7x \equiv 3 \pmod{19}?

Q9

For what modulus mm is 12≡2(modm)12 \equiv 2 \pmod m valid?

Q10

In the Chinese Remainder Theorem example, what is the unique solution modulo 105 for x≡2(mod3)x \equiv 2 \pmod 3, x≡3(mod5)x \equiv 3 \pmod 5, and x≡2(mod7)x \equiv 2 \pmod 7?