Subjects number theory

Modular Exponentiation

Step-by-step solutions with LaTeX - clean, fast, and student-friendly.

Search Solutions

Modular Exponentiation


1. **State the problem:** Calculate $254^{94} \bmod 160$ efficiently by hand. 2. **Simplify the base modulo 160:** Since $254 > 160$, reduce it first: $$254 \bmod 160 = 254 - 160 = 94$$ So the problem becomes: $$94^{94} \bmod 160$$ 3. **Use modular exponentiation properties:** We want to find $94^{94} \bmod 160$. Direct calculation is impossible by hand, so use repeated squaring and reduce modulo 160 at each step. 4. **Calculate powers by repeated squaring:** - $94^1 \equiv 94 \bmod 160$ - $94^2 = 94 \times 94 = 8836 \equiv 8836 - 55 \times 160 = 8836 - 8800 = 36 \bmod 160$ - $94^4 = (94^2)^2 = 36^2 = 1296 \equiv 1296 - 8 \times 160 = 1296 - 1280 = 16 \bmod 160$ - $94^8 = (94^4)^2 = 16^2 = 256 \equiv 256 - 1 \times 160 = 96 \bmod 160$ - $94^{16} = (94^8)^2 = 96^2 = 9216 \equiv 9216 - 57 \times 160 = 9216 - 9120 = 96 \bmod 160$ - $94^{32} = (94^{16})^2 = 96^2 = 9216 \equiv 96 \bmod 160$ - $94^{64} = (94^{32})^2 = 96^2 = 9216 \equiv 96 \bmod 160$ 5. **Express 94 as sum of powers of two:** $$94 = 64 + 16 + 8 + 4 + 2$$ 6. **Combine powers:** $$94^{94} = 94^{64} \times 94^{16} \times 94^{8} \times 94^{4} \times 94^{2} \bmod 160$$ Substitute values: $$= 96 \times 96 \times 96 \times 16 \times 36 \bmod 160$$ 7. **Calculate stepwise:** - $96 \times 96 = 9216 \equiv 96 \bmod 160$ - $96 \times 96 = 9216 \equiv 96 \bmod 160$ - $96 \times 16 = 1536 \equiv 1536 - 9 \times 160 = 1536 - 1440 = 96 \bmod 160$ - $96 \times 36 = 3456 \equiv 3456 - 21 \times 160 = 3456 - 3360 = 96 \bmod 160$ So the final result is: $$94^{94} \equiv 96 \bmod 160$$ 8. **Answer:** $$\boxed{96}$$ 9. **How to do these problems fast:** - Always reduce the base modulo the modulus first. - Use repeated squaring to compute powers efficiently. - Break down the exponent into powers of two. - Multiply intermediate results modulo the modulus to keep numbers small. - Practice modular arithmetic properties and patterns to speed up calculations.