Level 5 — MasteryNumber Theory (Intermediate)

Number Theory (Intermediate)

75 minutes50 marksprintable — key stays hidden on paper

Level 5 — Mastery (cross-domain: proof, computation, coding) Time limit: 75 minutes Total marks: 50

Answer all questions. Show full working. Where a proof is requested, every logical step must be justified.


Question 1 — Proof & structure of the real number system (16 marks)

(a) Prove that 2\sqrt{2} is irrational. State clearly which assumption gives the contradiction. (6)

(b) Using divisibility rules (not long division), determine whether N=5940N = 5\,940 is divisible by each of 44, 99, and 1111. Justify each answer using the rule and, for the rule of 1111, prove why it works by writing NN in terms of powers of 1010 modulo 1111. (6)

(c) A student claims: "Every rational number has a terminating decimal expansion." Give a precise counterexample and state the exact criterion (in terms of the prime factorisation of the denominator of a fraction in lowest terms) for a rational to have a terminating expansion. (4)


Question 2 — Euclidean machinery & CRT (18 marks)

(a) Use the Euclidean algorithm to compute gcd(1769,551)\gcd(1\,769, 551), writing out each division step. (4)

(b) Use the extended Euclidean algorithm to find integers x,yx,y satisfying Bézout's identity 1769x+551y=gcd(1769,551).1769\,x + 551\,y = \gcd(1769,551). (6)

(c) Solve the simultaneous congruence system x2(mod3),x3(mod5),x2(mod7)x \equiv 2 \pmod 3, \qquad x \equiv 3 \pmod 5, \qquad x \equiv 2 \pmod 7 using the Chinese Remainder Theorem. Give the unique solution modulo 105105 and explain why uniqueness holds. (8)


Question 3 — Modular arithmetic meets physics & code (16 marks)

(a) State Fermat's Little Theorem. Using it, compute 3100mod73^{100} \bmod 7 without computing the full power. Show your reduction of the exponent. (5)

(b) A rotating disk in a physics experiment has 1212 equally spaced markers (0..110..11). Each "tick" the disk advances by 77 marker-positions; the read-out is the marker index taken modulo 1212. Starting at marker 00, prove that after some number of ticks the read-out returns to 00, find the smallest such positive number of ticks, and explain the connection to gcd(7,12)\gcd(7,12). (5)

(c) Write pseudocode (or Python) for a function modexp(a, e, m) that computes aemodma^e \bmod m by fast exponentiation (squaring), and explain why its running time is O(loge)O(\log e) modular multiplications rather than O(e)O(e). Give the value your function returns for modexp(3, 100, 7). (6)


End of paper.

Answer keyMark scheme & solutions

Question 1

(a) Irrationality of 2\sqrt2 (6)

  • Assume for contradiction 2=a/b\sqrt2 = a/b with a,bZa,b\in\mathbb Z, b0b\neq0, and gcd(a,b)=1\gcd(a,b)=1 (fraction in lowest terms). (1)
  • Then 2b2=a22b^2 = a^2, so a2a^2 is even a\Rightarrow a is even (since the square of an odd number is odd). Write a=2ka=2k. (2)
  • Then 2b2=4k2b2=2k22b^2 = 4k^2 \Rightarrow b^2 = 2k^2, so b2b^2 is even b\Rightarrow b is even. (2)
  • Now 2a2\mid a and 2b2\mid b contradicts gcd(a,b)=1\gcd(a,b)=1. Hence no such fraction exists: 2\sqrt2 is irrational. (1)

(b) Divisibility of 59405940 (6)

  • By 4: last two digits 4040; 40=4×1040 = 4\times10, divisible by 4. ✓ (1) (rule: 1000(mod4)100\equiv0\pmod4 so only last two digits matter)
  • By 9: digit sum 5+9+4+0=185+9+4+0=18, and 9189\mid18. ✓ (1)
  • By 11: alternating sum (from right) 04+95=00-4+9-5=0, and 11011\mid0. ✓ (1)
  • Proof of the 11-rule (3): Since 101(mod11)10\equiv-1\pmod{11}, we have 10k(1)k(mod11)10^k\equiv(-1)^k\pmod{11}. For N=kdk10kN=\sum_k d_k10^k, Nkdk(1)k(mod11),N\equiv \sum_k d_k(-1)^k \pmod{11}, which is exactly the alternating digit sum. Hence 11N    1111\mid N \iff 11 divides the alternating sum. For 59405940: 01+4(1)+91+5(1)=00\cdot1+4\cdot(-1)+9\cdot1+5\cdot(-1)=0. (3)

(c) Terminating criterion (4)

  • Counterexample: 13=0.3\tfrac13 = 0.\overline{3} is rational but non-terminating. (2)
  • Criterion: a fraction pq\tfrac pq in lowest terms has a terminating decimal expansion iff the only prime factors of qq are 22 and/or 55, i.e. q=2a5bq = 2^a5^b. (2)

Question 2

(a) gcd(1769,551)\gcd(1769,551) (4)

1769=3551+1161769 = 3\cdot551 + 116 551=4116+87551 = 4\cdot116 + 87 116=187+29116 = 1\cdot87 + 29 87=329+087 = 3\cdot29 + 0 Last nonzero remainder gcd=29\Rightarrow \gcd = 29. (4) (1 mark per correct line, or 4 for full correct chain)

(b) Bézout coefficients (6)

Back-substitute: 29=11618729 = 116 - 1\cdot87 =1161(5514116)=51161551= 116 - 1\cdot(551-4\cdot116) = 5\cdot116 - 1\cdot551 =5(17693551)1551=5176916551.= 5\cdot(1769-3\cdot551) - 1\cdot551 = 5\cdot1769 - 16\cdot551. So x=5, y=16x=5,\ y=-16:   1769(5)+551(16)=88458816=29.\;1769(5)+551(-16)=8845-8816=29.(6)

(c) CRT (8)

Moduli 3,5,73,5,7 pairwise coprime, M=105M=105. (1)

  • M1=35, 352(mod3), 212(mod3)M_1=35,\ 35\equiv2\pmod3,\ 2^{-1}\equiv2\pmod3\Rightarrow term =2352=140=2\cdot35\cdot2=140. (2)
  • M2=21, 211(mod5), 11=1M_2=21,\ 21\equiv1\pmod5,\ 1^{-1}=1\Rightarrow term =3211=63=3\cdot21\cdot1=63. (2)
  • M3=15, 151(mod7), 11=1M_3=15,\ 15\equiv1\pmod7,\ 1^{-1}=1\Rightarrow term =2151=30=2\cdot15\cdot1=30. (2)
  • x140+63+30=2332331052=23(mod105)x\equiv140+63+30=233\equiv233-105\cdot2=23\pmod{105}. (1)

Check: 232 (3)23\equiv2\ (3), 233 (5)23\equiv3\ (5), 232 (7)23\equiv2\ (7). ✓ Uniqueness: CRT guarantees a unique residue mod M=357=105M=3\cdot5\cdot7=105 since moduli are pairwise coprime.

Answer: x23(mod105)x\equiv 23 \pmod{105}.


Question 3

(a) Fermat + 3100mod73^{100}\bmod7 (5)

  • FLT: if pp prime and pap\nmid a, then ap11(modp)a^{p-1}\equiv1\pmod p. (1)
  • Here p=7p=7: 361(mod7)3^6\equiv1\pmod7. (1)
  • 100=616+4100 = 6\cdot16 + 4, so 3100=(36)163411634(mod7)3^{100}=(3^6)^{16}\cdot3^4\equiv1^{16}\cdot3^4\pmod7. (2)
  • 34=818177=4(mod7)3^4=81\equiv81-77=4\pmod7. Answer: 44. (1)

(b) Rotating disk (5)

  • After nn ticks read-out =7nmod12=7n\bmod12. Return to 00 means 127n12\mid 7n. (1)
  • Since gcd(7,12)=1\gcd(7,12)=1, 127n12n12\mid 7n \Rightarrow 12\mid n. (2)
  • Smallest positive such n=12n = 12. (1)
  • General principle: the disk revisits 00 after 12gcd(7,12)=12\dfrac{12}{\gcd(7,12)} = 12 ticks; because 77 and 1212 are coprime, all 1212 markers are visited before repeating (the step generates the whole cyclic group Z12\mathbb Z_{12}). (1)

(c) Fast exponentiation (6)

def modexp(a, e, m):
    result = 1
    a = a % m
    while e > 0:
        if e & 1:            # if lowest bit set, multiply
            result = (result * a) % m
        a = (a * a) % m      # square the base
        e >>= 1              # drop processed bit
    return result
  • Correctness: uses ae=a2ia^e = \prod a^{2^i} over set bits of ee. (2)
  • Complexity: the loop runs once per bit of ee, i.e. log2e+1\lfloor\log_2 e\rfloor+1 iterations, each doing O(1)O(1) modular multiplications O(loge)\Rightarrow O(\log e) multiplications, vastly better than O(e)O(e) for naive repeated multiplication. (2)
  • modexp(3, 100, 7) returns 4 (consistent with part (a)). (2)

[
  {"claim":"gcd(1769,551)=29","code":"result = (gcd(1769,551)==29)"},
  {"claim":"Bezout: 1769*5 + 551*(-16) = 29","code":"result = (1769*5 + 551*(-16) == 29)"},
  {"claim":"CRT solution x=23 mod 105 satisfies all three congruences","code":"result = (23%3==2 and 23%5==3 and 23%7==2)"},
  {"claim":"3^100 mod 7 = 4","code":"result = (pow(3,100,7)==4)"},
  {"claim":"disk returns to 0 first at n=12 ticks","code":"result = (min(n for n in range(1,100) if (7*n)%12==0)==12)"}
]