Number Theory (Intermediate)
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 is irrational. State clearly which assumption gives the contradiction. (6)
(b) Using divisibility rules (not long division), determine whether is divisible by each of , , and . Justify each answer using the rule and, for the rule of , prove why it works by writing in terms of powers of modulo . (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 , writing out each division step. (4)
(b) Use the extended Euclidean algorithm to find integers satisfying Bézout's identity (6)
(c) Solve the simultaneous congruence system using the Chinese Remainder Theorem. Give the unique solution modulo and explain why uniqueness holds. (8)
Question 3 — Modular arithmetic meets physics & code (16 marks)
(a) State Fermat's Little Theorem. Using it, compute without computing the full power. Show your reduction of the exponent. (5)
(b) A rotating disk in a physics experiment has equally spaced markers (). Each "tick" the disk advances by marker-positions; the read-out is the marker index taken modulo . Starting at marker , prove that after some number of ticks the read-out returns to , find the smallest such positive number of ticks, and explain the connection to . (5)
(c) Write pseudocode (or Python) for a function modexp(a, e, m) that computes by fast exponentiation (squaring), and explain why its running time is modular multiplications rather than . Give the value your function returns for modexp(3, 100, 7). (6)
End of paper.
Answer keyMark scheme & solutions
Question 1
(a) Irrationality of (6)
- Assume for contradiction with , , and (fraction in lowest terms). (1)
- Then , so is even is even (since the square of an odd number is odd). Write . (2)
- Then , so is even is even. (2)
- Now and contradicts . Hence no such fraction exists: is irrational. (1)
(b) Divisibility of (6)
- By 4: last two digits ; , divisible by 4. ✓ (1) (rule: so only last two digits matter)
- By 9: digit sum , and . ✓ (1)
- By 11: alternating sum (from right) , and . ✓ (1)
- Proof of the 11-rule (3): Since , we have . For , which is exactly the alternating digit sum. Hence divides the alternating sum. For : . (3)
(c) Terminating criterion (4)
- Counterexample: is rational but non-terminating. (2)
- Criterion: a fraction in lowest terms has a terminating decimal expansion iff the only prime factors of are and/or , i.e. . (2)
Question 2
(a) (4)
Last nonzero remainder . (4) (1 mark per correct line, or 4 for full correct chain)
(b) Bézout coefficients (6)
Back-substitute: So : ✓ (6)
(c) CRT (8)
Moduli pairwise coprime, . (1)
- term . (2)
- term . (2)
- term . (2)
- . (1)
Check: , , . ✓ Uniqueness: CRT guarantees a unique residue mod since moduli are pairwise coprime.
Answer: .
Question 3
(a) Fermat + (5)
- FLT: if prime and , then . (1)
- Here : . (1)
- , so . (2)
- . Answer: . (1)
(b) Rotating disk (5)
- After ticks read-out . Return to means . (1)
- Since , . (2)
- Smallest positive such . (1)
- General principle: the disk revisits after ticks; because and are coprime, all markers are visited before repeating (the step generates the whole cyclic group ). (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 over set bits of . (2)
- Complexity: the loop runs once per bit of , i.e. iterations, each doing modular multiplications multiplications, vastly better than 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)"}
]