LightMySky
به انگلیسی

Fermat's Little Theorem and Euler's Theorem

Prove that raising a unit to the size of the unit group returns one, and use it to shortcut enormous modular powers.

شروع یادگیری این موضوعبه حساب کاربری نیازی نیست. پیشرفت در همین مرورگر ذخیره می‌شود.

کارهایی که یادگیرنده بعد از این درس می‌تواند انجام دهد

  • Prove Fermat's little theorem by permuting the nonzero residues
  • Compute Euler's totient function and state the general theorem
  • Reduce a huge exponent modulo the totient before computing the power

۱ · بخوان

Fermat's little theorem says a to the power (p minus 1) leaves remainder 1 modulo p, for prime p not dividing a. So 2 to the power 10 is 1 modulo 11. The proof permutes the nonzero residues: multiplying them all by a just reshuffles the list.

Try it together

Euler widened the idea with the totient. Phi of n counts numbers from 1 to n that share no factor with n: phi of 9 is 6, namely 1, 2, 4, 5, 7, 8, and phi of 12 is 4. His theorem says a to the phi of n is 1 modulo n whenever a and n are coprime.

100 = 96 + 43^4 = 81
Reduce the exponent mod 6, then compute. 100 is 96 plus 4, so 3 to the 100th is 81, and 81 mod 7 is 4.

Reduce the exponent modulo the totient, never modulo n itself. Then finish with fast squaring: square down the binary form of the exponent, multiplying by the base only at set bits. A million multiplications shrink to about twenty steps.

4^5 = 4 x 4^44^4 = 1 mod 5
Split off Fermat blocks first. 4 to the 5th is 4 times 4 to the 4th, and 4 to the 4th is 1 mod 5, so the answer is 4.

Spot the prime or the totient, shrink the exponent, and compute the small power that remains.

Totient and permutation questions x3 and x5 are original in-repo writing; other items adapt problems, academy and textbooks material with unknown license terms. Readings "Modular exponentiation", "Fast modular exponentiation" and "Trial division" adapt academy material with unknown license terms. The rewritten readings were written for this dataset.

۲ · ببین

به انگلیسی

دور از صفحه‌نمایش

چاپ کاربرگکاغذ A4، با یک صفحهٔ جواب‌ها برای بزرگ‌ترها. بدون صفحه‌نمایش، بدون اینترنت.

جایگاه این موضوع

اول این‌ها را یاد بگیر

پیوندهای اختیاری

این موضوع راه این‌ها را باز می‌کند

سپس تمرین

۱۴ سؤال پشت این درس منتظرند، هر کدام با پاسخ توضیح‌داده‌شده. هر پاسخ آسمان را پر می‌کند: ستاره‌ها هنگام یادگیری روشن می‌شوند و وقتی زمان برگشتن است کمرنگ می‌شوند.

شروع یادگیری این موضوع