The Lumenary · Early undergraduate
Congruences
Name: ______________________
Date: ______________________
You will learn to
- Prove that congruence modulo is an equivalence relation compatible with addition and multiplication, and use it to compute with remainders
- Decide when has an inverse modulo and solve linear congruences using Euclid's algorithm
- State and prove the Chinese remainder theorem, and solve systems of congruences with coprime moduli
- Prove Fermat's little theorem, Euler's theorem and Wilson's theorem, and use them to compute large powers modulo
- Explain why the converse of Fermat's theorem fails, using the Carmichael number
- 1.
Which of these statements are true? (Choose all that apply.)
- A.
- B.
- C., so
- D. implies
- E., because
- 2.
What is the last digit of ?
- 3.
Find the inverse of modulo : the with .
- 4.
Find the smallest positive integer with , and .
- 5.
How many solutions modulo does the congruence have?
- 6.
The second proof of Fermat's theorem reaches and then cancels . What justifies the cancellation?
- A. is coprime to , because the prime divides none of the factors (Euclid's lemma)
- B., by Wilson's theorem
- C.Any non-zero number can be cancelled in a congruence
- D. is smaller than
- 7.
Claim: "If for every coprime to , then is prime." Which number is a counterexample?
- A.
- B.
- C.
- D.
- 8.
Which Lean statement correctly formalises the existence half of the Chinese remainder theorem? (
IsCoprime m nmeans for some .)- A.
theorem t {m n : ℤ} (h : IsCoprime m n) (a b : ℤ) : ∃ x, x ≡ a [ZMOD m] ∧ x ≡ b [ZMOD n] - B.
theorem t {m n : ℤ} (a b : ℤ) : ∃ x, x ≡ a [ZMOD m] ∧ x ≡ b [ZMOD n] - C.
theorem t {m n : ℤ} (h : IsCoprime m n) (a b : ℤ) : ∀ x, x ≡ a [ZMOD m] ∧ x ≡ b [ZMOD n] - D.
theorem t {m n x y : ℤ} (h : IsCoprime m n) (hm : x ≡ y [ZMOD m]) (hn : x ≡ y [ZMOD n]) : x ≡ y [ZMOD m * n]
- A.
- 9.
Write
crt(residues, moduli)that returns the smallest with for all , assuming the moduli are pairwise coprime. Combine the congruences one at a time, using an inverse modulo (Python'spow(a, -1, m)computes one). Then check Sunzi's answer.Computational — Practice