A Power Modulo \(11\)
Find \(2^{2026}\pmod{11}\).
Reduce the exponent modulo \(10\).
By Fermat, \(2^{10}\equiv1\pmod{11}\). Since \(2026\equiv6\pmod{10}\), we get \(2^{2026}\equiv2^6=64\equiv9\pmod{11}\).
Chapter
Theory
Fermat, Euler, and Wilson are not isolated facts to memorise; they are tools for turning large powers and factorials into small residues. In olympiad problems, the key is knowing which theorem applies and why the hypotheses hold.
Fermat's little theorem: if \(p\) is prime and \(p\nmid a\), then \(a^{p-1}\equiv1\pmod p\). In the form \(a^p\equiv a\pmod p\), it holds for all integers \(a\). Euler's theorem: if \(\gcd(a,n)=1\), then \(a^{\varphi(n)}\equiv1\pmod n\). Wilson's theorem: \(p\) is prime if and only if \((p-1)!\equiv-1\pmod p\).
Use Fermat for powers modulo a prime. Use Euler for powers modulo a composite modulus when coprimality holds. Use Wilson for factorials modulo a prime, especially when \((p-1)!\), \((p-2)!\), or the product of all nonzero residues appears.
If the exponent resembles \(p-1\), \(p\), or a multiple of \(p-1\), try Fermat. If the modulus is composite and the base is coprime to it, look for \(\varphi(n)\). If a factorial almost reaches a prime \(p\), try Wilson.
Do not apply Euler's theorem without checking \(\gcd(a,n)=1\). Do not replace \(\varphi(n)\) by \(n-1\) when \(n\) is not prime. In Wilson's theorem, primality of the modulus is essential: for composite \(n\), the congruence usually fails.
1. Is the modulus prime or composite? 2. Is the base coprime to the modulus? 3. Which exponent can be reduced: \(p-1\) or \(\varphi(n)\)? 4. Can the factorial be replaced using Wilson? 5. Has the small case \(p=2\) been checked?
Examples
This teaches reducing the exponent modulo \(p-1\).
Problem. Find \(2^{2026}\pmod{11}\).
Since \(11\) is prime and \(2^{10}\equiv1\pmod{11}\), reduce the exponent: \(2026\equiv6\pmod{10}\). Thus \(2^{2026}\equiv2^6=64\equiv9\pmod{11}\).
Comment. Coprimality is obvious here: \(11\nmid2\).
This shows work with a composite modulus.
Problem. Find \(2^{100}\pmod9\).
We have \(\varphi(9)=6\) and \(\gcd(2,9)=1\). Hence \(2^6\equiv1\pmod9\). Since \(100\equiv4\pmod6\), we get \(2^{100}\equiv2^4=16\equiv7\pmod9\).
Comment. Euler requires the base and modulus to be coprime.
This shows how to find an inverse residue.
Problem. Find the inverse of \(5\) modulo \(17\).
By Fermat, \(5^{16}\equiv1\pmod{17}\), so \(5^{15}\) is the inverse of \(5\). But directly, \(5\cdot7=35\equiv1\pmod{17}\). Answer: \(7\).
Comment. The theorem gives existence and a general method, but a small modulus can be computed directly.
First application of Wilson's theorem.
Problem. Find the residue of \(10!\) modulo \(11\).
Since \(11\) is prime, Wilson's theorem gives \(10!\equiv-1\equiv10\pmod{11}\).
Comment. A factorial almost up to a prime points immediately to Wilson.
This teaches removing the last factors from Wilson.
Problem. Find \(8!\pmod{11}\).
By Wilson, \(10!\equiv-1\pmod{11}\). But \(10!=10\cdot9\cdot8!\equiv(-1)(-2)8!\equiv2\cdot8!\pmod{11}\). Hence \(2\cdot8!\equiv-1\equiv10\), so \(8!\equiv5\pmod{11}\).
Comment. Incomplete factorials are often recovered from the full one.
This shows the universal form of Fermat.
Problem. Prove that \(p\mid a^p-a\) for every prime \(p\) and every integer \(a\).
If \(p\mid a\), the claim is obvious. If \(p\nmid a\), Fermat gives \(a^{p-1}\equiv1\pmod p\). Multiplying by \(a\), we get \(a^p\equiv a\pmod p\).
Comment. This form is convenient when \(a\) may be divisible by \(p\).
This shows how Wilson recognises primes.
Problem. Check the congruence \(6!\equiv-1\pmod7\).
Since \(7\) is prime, Wilson gives \(6!\equiv-1\pmod7\). Indeed, \(720=7\cdot102+6\), so \(6\equiv-1\pmod7\).
Comment. For a composite modulus, this conclusion is not allowed.
This combines Euler and residues.
Problem. Find the last two digits of \(3^{80}\).
Work modulo \(100\). Since \(\gcd(3,100)=1\) and \(\varphi(100)=40\), \(3^{40}\equiv1\pmod{100}\). Therefore \(3^{80}\equiv1\pmod{100}\). The last two digits are \(01\).
Comment. For modulus \(100\), Fermat modulo a prime is not enough.
Problems
Find \(2^{2026}\pmod{11}\).
Reduce the exponent modulo \(10\).
By Fermat, \(2^{10}\equiv1\pmod{11}\). Since \(2026\equiv6\pmod{10}\), we get \(2^{2026}\equiv2^6=64\equiv9\pmod{11}\).
Find \(2^{100}\pmod9\).
Use \(\varphi(9)=6\).
Since \(\gcd(2,9)=1\), Euler gives \(2^6\equiv1\pmod9\). Since \(100\equiv4\pmod6\), \(2^{100}\equiv2^4=16\equiv7\pmod9\).
Find the inverse of \(7\) modulo \(13\).
Compute directly or use \(7^{11}\).
Directly, \(7\cdot2=14\equiv1\pmod{13}\). Thus the inverse is \(2\). This agrees with Fermat: \(7^{12}\equiv1\), so \(7^{11}\) is also an inverse.
Find \(10!\pmod{11}\).
Apply Wilson.
Since \(11\) is prime, \(10!\equiv-1\equiv10\pmod{11}\).
Find \(\varphi(45)\).
Factor \(45=3^2\cdot5\).
Use the formula: \(\varphi(45)=45(1-1/3)(1-1/5)=45\cdot2/3\cdot4/5=24\).
Prove that for every prime \(p\) and every integer \(a\), \(p\mid a^p-a\).
Consider the cases \(p\mid a\) and \(p\nmid a\).
If \(p\mid a\), then \(a^p-a\) is divisible by \(p\). If \(p\nmid a\), Fermat gives \(a^{p-1}\equiv1\pmod p\), and multiplying by \(a\) gives \(a^p\equiv a\pmod p\).
Find \(7^{100}\pmod{13}\).
Reduce the exponent modulo \(12\).
By Fermat, \(7^{12}\equiv1\pmod{13}\). Since \(100\equiv4\pmod{12}\), \(7^{100}\equiv7^4\). Now \(7^2=49\equiv10\), so \(7^4\equiv100\equiv9\pmod{13}\).
Find the last two digits of \(3^{80}\).
Work modulo \(100\).
\(\gcd(3,100)=1\), \(\varphi(100)=40\). Euler gives \(3^{40}\equiv1\pmod{100}\), hence \(3^{80}\equiv1\pmod{100}\). The last two digits are \(01\).
Find \(8!\pmod{11}\).
Express \(10!\) through \(8!\).
By Wilson, \(10!\equiv-1\pmod{11}\). But \(10!=10\cdot9\cdot8!\equiv(-1)(-2)8!\equiv2\cdot8!\). Hence \(2\cdot8!\equiv10\), so \(8!\equiv5\pmod{11}\).
Let \(p\) be an odd prime. Prove that \((p-2)!\equiv1\pmod p\).
Write \((p-1)!=(p-1)(p-2)!\).
By Wilson, \((p-1)!\equiv-1\pmod p\). But \((p-1)!\equiv(p-1)(p-2)!\equiv-(p-2)!\pmod p\). Hence \(-(p-2)!\equiv-1\), so \((p-2)!\equiv1\pmod p\).
Let \(p>3\) be prime. Find \((p-3)!\pmod p\).
Express \((p-1)!\) through \((p-3)!\).
We have \((p-1)!=(p-1)(p-2)(p-3)!\equiv(-1)(-2)(p-3)!\equiv2(p-3)!\pmod p\). By Wilson this equals \(-1\). Hence \(2(p-3)!\equiv-1\), so \((p-3)!\equiv -2^{-1}\pmod p\). Since \(2^{-1}\equiv (p+1)/2\), we get \((p-3)!\equiv (p-1)/2\pmod p\).
Find the remainder of \(7^{222}\) modulo \(100\).
Use \(\varphi(100)=40\), but a short cycle is even better.
Notice that \(7^4\equiv1\pmod{100}\). Since \(222\equiv2\pmod4\), we get \(7^{222}\equiv7^2=49\pmod{100}\).
Let \(p\) be prime. Prove that \(p\mid a^{p+1}-a^2\) for every integer \(a\).
Factor \(a\), or use \(a^p\equiv a\).
By Fermat's form, \(a^p\equiv a\pmod p\). Multiplying by \(a\), we get \(a^{p+1}\equiv a^2\pmod p\). Hence \(p\mid a^{p+1}-a^2\).
Show that \(8!\not\equiv-1\pmod9\), and explain why this does not contradict Wilson.
The product \(8!\) contains factors \(3\) and \(6\).
Since \(8!\) contains factors \(3\) and \(6\), the product is divisible by \(9\). Thus \(8!\equiv0\pmod9\), not \(-1\). There is no contradiction: Wilson's theorem states \((p-1)!\equiv-1\pmod p\) for prime \(p\), while \(9\) is composite.
Let \(\gcd(a,n)=1\). Prove that \(a^{\varphi(n)-1}\) is the inverse of \(a\) modulo \(n\).
Multiply by \(a\) and apply Euler.
Euler's theorem gives \(a^{\varphi(n)}\equiv1\pmod n\). But \(a\cdot a^{\varphi(n)-1}=a^{\varphi(n)}\). Hence \(a^{\varphi(n)-1}\) is indeed the inverse.
Find all primes \(p\) such that \(p\mid2^{p-1}+1\).
Handle \(p=2\), then apply Fermat.
For \(p=2\), \(2^{p-1}+1=3\) is not divisible by \(2\). If \(p\) is odd, Fermat gives \(2^{p-1}\equiv1\pmod p\). Then \(2^{p-1}+1\equiv2\pmod p\), not \(0\). Answer: there are no such primes.
Prove Wilson's theorem: if \(p\) is prime, then \((p-1)!\equiv-1\pmod p\).
Pair nonzero residues with their inverses.
In the set \(1,2,\ldots,p-1\), every residue has an inverse. Residues equal to their own inverses satisfy \(x^2\equiv1\pmod p\), hence \(x\equiv1\) or \(x\equiv-1\pmod p\). All other residues pair as \(x,x^{-1}\), and each pair has product \(1\). Therefore \((p-1)!\equiv1\cdot(-1)\equiv-1\pmod p\).
Let \(p>3\) be prime. Find the product of all \(x\in\{1,\ldots,p-1\}\) such that \(x\not\equiv x^{-1}\pmod p\), modulo \(p\).
Remove the self-inverse elements \(1\) and \(-1\).
The self-inverse elements satisfy \(x^2\equiv1\pmod p\), so they are \(1\) and \(-1\). The product of all nonzero residues is \((p-1)!\equiv-1\pmod p\). Removing the factors \(1\) and \(-1\), the remaining product is \((-1)/(1\cdot(-1))\equiv1\pmod p\).
Find the remainder of \(11^{2026}\) modulo \(72\).
Use \(\varphi(72)=24\), or split \(72=8\cdot9\).
\(\gcd(11,72)=1\), \(\varphi(72)=72(1-1/2)(1-1/3)=24\). Thus \(11^{24}\equiv1\pmod{72}\). Since \(2026\equiv10\pmod{24}\), we need \(11^{10}\pmod{72}\). Now \(11^2=121\equiv49\), \(11^4\equiv49^2=2401\equiv25\), \(11^8\equiv25^2=625\equiv49\). Hence \(11^{10}=11^8\cdot11^2\equiv49\cdot49=2401\equiv25\pmod{72}\).
Prove that if \(n>1\) and \((n-1)!\equiv-1\pmod n\), then \(n\) is prime.
Assume \(n\) is composite and take a proper divisor \(d\) of \(n\).
Ladders