math / tasks /modular-arithmetic /modular-arithmetic-congruence_chain-d3-e0008 /solution /Solution.lean
Download tasks/modular-arithmetic/modular-arithmetic-congruence_chain-d3-e0008/solution/Solution.lean from RenaissanceLabsEU/math: direct link, hf CLI and curl.
- Browser
- Download file 586 Bytes
-
https://huggingface.co/datasets/RenaissanceLabsEU/math/resolve/main/tasks/modular-arithmetic/modular-arithmetic-congruence_chain-d3-e0008/solution/Solution.lean
- Command line
-
hf download hf://datasets/RenaissanceLabsEU/math/tasks/modular-arithmetic/modular-arithmetic-congruence_chain-d3-e0008/solution/Solution.lean
-
curl -L -o Solution.lean https://huggingface.co/datasets/RenaissanceLabsEU/math/resolve/main/tasks/modular-arithmetic/modular-arithmetic-congruence_chain-d3-e0008/solution/Solution.lean
586 Bytes
| import Mathlib | |
| /-- A large power of x has the stated residue. -/ | |
| theorem congr_pow (x : ℤ) (h : x ≡ 3 [ZMOD 10]) : | |
| x ^ 18 ≡ 9 [ZMOD 10] := by | |
| refine (h.pow 18).trans ?_ | |
| norm_num [Int.ModEq] | |
| /-- The combined expression has the stated residue. -/ | |
| theorem congr_product (x y : ℤ) (hx : x ≡ 3 [ZMOD 10]) (hy : y ≡ 4 [ZMOD 10]) : | |
| x ^ 18 * y ^ 12 + 4 ≡ 8 [ZMOD 10] := by | |
| have h1 := congr_pow x hx | |
| have h2 : y ^ 12 ≡ 6 [ZMOD 10] := by | |
| refine (hy.pow 12).trans ?_ | |
| norm_num [Int.ModEq] | |
| refine ((h1.mul h2).add_right 4).trans ?_ | |
| norm_num [Int.ModEq] | |