Học tập / Giai đoạn 2 · Lớp 8–9: Học sinh giỏi
Lesson 10. Advanced congruences and Fermat’s little theoremLesson 10. Advanced congruences and Fermat’s little theorem
🧭 Chủ đề:Topic: Số học: chia hết, số nguyên tốNumber theory · xem bài cùng chủ đề ở mọi độ tuổisee this topic at every age
🎯 Sau bài này bạn sẽ
Tính số dư của lũy thừa rất lớn Dùng định lý Fermat nhỏ và số dư của số chính phương
Find remainders of very large powers Use Fermat’s little theorem and the remainders of squares
Định lý Fermat nhỏ. Nếu $p$ là số nguyên tố và $p \nmid a$ thì $a^{p - 1} \equiv 1 \pmod p$.
Ví dụ 1
Tìm số dư của $2^{100}$ khi chia cho 7. — Theo Fermat, $2^6 \equiv 1 \pmod 7$. Mà $100 = 6 \cdot 16 + 4$ nên $2^{100} \equiv 2^4 = 16 \equiv 2$.
(Thực ra $2^3 = 8 \equiv 1 \pmod 7$ còn nhanh hơn: $2^{100} = (2^3)^{33} \cdot 2 \equiv 2$. Luôn tìm chu kì nhỏ nhất!)
Số dư của số chính phương
| Môđun | Số dư có thể của $n^2$ |
|---|---|
| 3 | 0, 1 |
| 4 | 0, 1 |
| 8 | 0, 1, 4 |
| 5 | 0, 1, 4 |
Ví dụ 2. Chứng minh $x^2 + y^2 = 2027$ không có nghiệm nguyên. — $x^2 + y^2$ chia 4 chỉ dư 0, 1, 2; mà $2027 \equiv 3 \pmod 4$. ∎
Muốn chứng minh phương trình vô nghiệm nguyên, hãy thử xét hai vế theo môđun 3, 4, 5, 8, 9 — một môđun “đúng” sẽ lộ mâu thuẫn.
Bài toán từ IMO
🏅 IMO 1978 — Bài 1
Cho $m, n$ là các số nguyên dương, $n > m \ge 1$, sao cho ba chữ số tận cùng của $1978^m$ và $1978^n$ giống nhau. Tìm $m, n$ để $m + n$ nhỏ nhất.
Lời giải (hãy tự làm ít nhất 30 phút trước khi mở)
Điều kiện là $1000 \mid 1978^n - 1978^m = 1978^m(1978^{n-m} - 1)$, với $1000 = 8 \cdot 125$.
- Phần 8: $1978^{n-m} - 1$ lẻ, còn $1978 = 2 \cdot 989$, nên cần $8 \mid 1978^m$, tức $m \ge 3$.
- Phần 125: $\gcd(1978, 125) = 1$ nên cần $125 \mid 1978^k - 1$ với $k = n - m$. Ta có $1978 \equiv 103 \pmod{125}$. Theo định lý Euler, cấp của 103 theo môđun 125 là ước của $\varphi(125) = 100$. Mặt khác $103 \equiv 3 \pmod 5$ có cấp 4, nên $4 \mid k$; vậy $k \in \{4, 20, 100\}$. Tính: $103^2 \equiv 109$, $103^4 \equiv 109^2 \equiv 6$, $103^{20} \equiv 6^5 \equiv 26 \pmod{125}$ — đều khác 1. Do đó $k = 100$.
Vậy $m + n = 2m + 100$ nhỏ nhất khi $m = 3$, $n = 103$, và $m + n = 106$. $\blacksquare$
Fermat’s little theorem. If $p$ is prime and $p \nmid a$, then $a^{p - 1} \equiv 1 \pmod p$.
Example 1
Find the remainder of $2^{100}$ on division by 7. — By Fermat, $2^6 \equiv 1 \pmod 7$. Since $100 = 6 \cdot 16 + 4$, $2^{100} \equiv 2^4 = 16 \equiv 2$.
(In fact $2^3 = 8 \equiv 1 \pmod 7$ is even faster: $2^{100} = (2^3)^{33} \cdot 2 \equiv 2$. Always look for the shortest cycle!)
Remainders of squares
| Modulus | Possible remainders of $n^2$ |
|---|---|
| 3 | 0, 1 |
| 4 | 0, 1 |
| 8 | 0, 1, 4 |
| 5 | 0, 1, 4 |
Example 2. Prove that $x^2 + y^2 = 2027$ has no integer solutions. — $x^2 + y^2$ leaves only 0, 1 or 2 mod 4, but $2027 \equiv 3 \pmod 4$. ∎
To show that an equation has no integer solutions, look at both sides modulo 3, 4, 5, 8, 9 — the “right” modulus will reveal a contradiction.
A problem from the IMO
🏅 IMO 1978 — Problem 1
Let $m, n$ be positive integers with $n > m \ge 1$ such that the last three digits of $1978^m$ and $1978^n$ are equal. Find $m$ and $n$ so that $m + n$ is as small as possible.
Solution (try it yourself for at least 30 minutes before opening)
The condition is $1000 \mid 1978^n - 1978^m = 1978^m(1978^{n-m} - 1)$, with $1000 = 8 \cdot 125$.
- The factor 8: $1978^{n-m} - 1$ is odd and $1978 = 2 \cdot 989$, so we need $8 \mid 1978^m$, i.e. $m \ge 3$.
- The factor 125: $\gcd(1978, 125) = 1$, so we need $125 \mid 1978^k - 1$ with $k = n - m$. Now $1978 \equiv 103 \pmod{125}$. By Euler’s theorem the order of 103 modulo 125 divides $\varphi(125) = 100$. Also $103 \equiv 3 \pmod 5$ has order 4, so $4 \mid k$; hence $k \in \{4, 20, 100\}$. Computing: $103^2 \equiv 109$, $103^4 \equiv 109^2 \equiv 6$, $103^{20} \equiv 6^5 \equiv 26 \pmod{125}$ — none equal 1. So $k = 100$.
Thus $m + n = 2m + 100$ is smallest for $m = 3$, $n = 103$, giving $m + n = 106$. $\blacksquare$
Bình luận (0)
Chưa có bình luận nào. Hãy là người đầu tiên!