Level 3 — ProductionNumber Theory (Intermediate)

Number Theory (Intermediate)

45 minutes60 marksprintable — key stays hidden on paper

Time limit: 45 minutes
Total marks: 60
Instructions: Show all working. Derivations must be from scratch — no citing results without justification where a proof is requested. Use ...... for mathematics.


Question 1. (10 marks) (a) Prove the divisibility rule for 11: an integer NN is divisible by 11 if and only if the alternating sum of its digits is divisible by 11. State clearly the property of 10(mod11)10 \pmod{11} that drives the proof. (6)

(b) Using your rule, determine whether 918082918082 is divisible by 11, showing the alternating sum. (4)


Question 2. (10 marks) Prove from first principles that 2\sqrt{2} is irrational. Your proof must:

  • state the assumption you contradict, (2)
  • use the fact that a fraction can be taken in lowest terms, (2)
  • derive that both numerator and denominator are even, (4)
  • conclude the contradiction cleanly. (2)

Question 3. (12 marks) (a) Use the Euclidean algorithm to compute gcd(1071,462)\gcd(1071, 462), showing each division step. (4)

(b) Run the Extended Euclidean algorithm to find integers x,yx, y with 1071x+462y=gcd(1071,462).1071x + 462y = \gcd(1071,462). Show your back-substitution or table clearly. (6)

(c) State Bézout's identity in general and verify your (x,y)(x,y) satisfy it. (2)


Question 4. (10 marks) Write, from memory, pseudocode (or Python) for the recursive Extended Euclidean Algorithm that returns (g,x,y)(g, x, y) with ax+by=g=gcd(a,b)ax + by = g = \gcd(a,b).

  • Give the base case. (3)
  • Give the recursive step with the correct coefficient update. (5)
  • Explain in one sentence why the coefficient update is correct. (2)

Question 5. (10 marks) Solve the simultaneous congruence system using the Chinese Remainder Theorem: x2(mod3),x3(mod5),x2(mod7).x \equiv 2 \pmod 3, \qquad x \equiv 3 \pmod 5, \qquad x \equiv 2 \pmod 7.

  • Show the modular inverses you compute. (6)
  • Give the unique solution modulo 105105. (4)

Question 6. (8 marks) (a) State Fermat's Little Theorem precisely, including the hypothesis on pp and aa. (3)

(b) Use it to compute 3100mod73^{100} \bmod 7 without expanding the power. Show the exponent reduction. (5)


Answer keyMark scheme & solutions

Question 1 (10 marks)

(a) Proof of the rule for 11 (6): Write N=k=0ndk10kN = \sum_{k=0}^{n} d_k 10^k (digits dkd_k). (1) Key fact: 101(mod11)10 \equiv -1 \pmod{11}, hence 10k(1)k(mod11)10^k \equiv (-1)^k \pmod{11}. (2) Therefore Nk=0ndk(1)k=d0d1+d2(mod11).N \equiv \sum_{k=0}^n d_k (-1)^k = d_0 - d_1 + d_2 - \cdots \pmod{11}. (2) So 11N    1111 \mid N \iff 11 \mid (alternating digit sum). Both directions follow since congruence mod 11 is an equivalence. (1)

(b) Test 918082918082 (4): Digits from units up: 2,8,0,8,1,92,8,0,8,1,9. Alternating sum =28+08+19=22= 2 - 8 + 0 - 8 + 1 - 9 = -22. (3) 22=2×11-22 = -2\times 11, divisible by 11, so 918082918082 is divisible by 11. (1) (Check: 918082/11=83462918082/11 = 83462.)


Question 2 (10 marks)

Assume 2\sqrt2 is rational: 2=p/q\sqrt2 = p/q with p,qZp,q \in \mathbb{Z}, q0q\neq 0. (2) Take the fraction in lowest terms, so gcd(p,q)=1\gcd(p,q)=1. (2) Then 2=p2/q2p2=2q22 = p^2/q^2 \Rightarrow p^2 = 2q^2, so p2p^2 is even p\Rightarrow p is even (odd² is odd). Write p=2mp=2m. (2) Substitute: 4m2=2q2q2=2m24m^2 = 2q^2 \Rightarrow q^2 = 2m^2, so q2q^2 even q\Rightarrow q even. (2) Then 2p2 \mid p and 2q2 \mid q, contradicting gcd(p,q)=1\gcd(p,q)=1. Hence 2\sqrt2 is irrational. \blacksquare (2)


Question 3 (12 marks)

(a) Euclidean algorithm (4): 1071=2462+1471071 = 2\cdot 462 + 147 462=3147+21462 = 3\cdot 147 + 21 147=721+0147 = 7\cdot 21 + 0 So gcd(1071,462)=21\gcd(1071,462) = 21. (4)

(b) Extended (6): back-substitute: 21=462314721 = 462 - 3\cdot 147 147=10712462147 = 1071 - 2\cdot 462 21=4623(10712462)=746231071.21 = 462 - 3(1071 - 2\cdot 462) = 7\cdot 462 - 3\cdot 1071. (4) So x=3, y=7x=-3,\ y=7: 1071(3)+462(7)=3213+3234=21.1071(-3)+462(7) = -3213 + 3234 = 21. (2)

(c) Bézout (2): For any integers a,ba,b (not both 0), there exist x,yx,y with ax+by=gcd(a,b)ax+by=\gcd(a,b). (1) Verification: 1071(3)+462(7)=21=gcd1071(-3)+462(7)=21=\gcd. ✓ (1)


Question 4 (10 marks)

def ext_gcd(a, b):
    if b == 0:               # base case (3)
        return (a, 1, 0)     # gcd=a, a*1 + 0*0 = a
    g, x1, y1 = ext_gcd(b, a % b)   # recurse (2)
    x = y1                          # coefficient update (2)
    y = x1 - (a // b) * y1          # (1)
    return (g, x, y)

Why correct (2): If g=bx1+(amodb)y1g = b x_1 + (a\bmod b) y_1 and amodb=aa/bba\bmod b = a - \lfloor a/b\rfloor b, substituting gives g=ay1+b(x1a/by1)g = a\,y_1 + b(x_1 - \lfloor a/b\rfloor y_1), matching the returned (x,y)(x,y).


Question 5 (10 marks)

Moduli 3,5,73,5,7, M=105M=105; M1=35,M2=21,M3=15M_1=35, M_2=21, M_3=15. (1) Inverses:

  • 352(mod3)35 \equiv 2 \pmod 3, need 2y1y=22y\equiv1 \Rightarrow y=2. (2)
  • 211(mod5)21 \equiv 1 \pmod 5, inverse =1=1. (2)
  • 151(mod7)15 \equiv 1 \pmod 7, inverse =1=1. (1)

x2352+3211+2151=140+63+30=233(mod105).x \equiv 2\cdot35\cdot2 + 3\cdot21\cdot1 + 2\cdot15\cdot1 = 140 + 63 + 30 = 233 \pmod{105}. (3) 233mod105=233210=23.233 \bmod 105 = 233 - 210 = 23. (1) Solution: x23(mod105)x \equiv 23 \pmod{105}. (Check: 23=37+223=3\cdot7+2✓, 23=45+323=4\cdot5+3✓, 23=37+223=3\cdot7+2✓)


Question 6 (8 marks)

(a) FLT (3): If pp is prime and pap \nmid a, then ap11(modp)a^{p-1} \equiv 1 \pmod p. (Equivalently apa(modp)a^p \equiv a \pmod p for all aa.)

(b) Compute 3100mod73^{100}\bmod 7 (5): p=7p=7, 737\nmid 3, so 361(mod7)3^6 \equiv 1 \pmod 7. (2) 100=616+4100 = 6\cdot16 + 4, so 3100=(36)163434(mod7)3^{100} = (3^6)^{16}\cdot 3^4 \equiv 3^4 \pmod 7. (2) 34=81=711+44(mod7)3^4 = 81 = 7\cdot11 + 4 \equiv 4 \pmod 7. Answer: 44. (1)


[
  {"claim":"918082 divisible by 11 and alt sum = -22", "code":"n=918082; alt=2-8+0-8+1-9; result=(n%11==0) and (alt==-22)"},
  {"claim":"Bezout: 1071*(-3)+462*7 = gcd(1071,462)=21", "code":"from sympy import gcd; result=(1071*(-3)+462*7==21) and (gcd(1071,462)==21)"},
  {"claim":"CRT solution 23 satisfies all three congruences", "code":"x=23; result=(x%3==2) and (x%5==3) and (x%7==2)"},
  {"claim":"3**100 mod 7 = 4", "code":"result=(pow(3,100,7)==4)"}
]