I'm having some trouble understanding how to calculate large exponentials, such as $41^{9182}$. I want to learn the modular exponentiation technique but one thing is not clear to me: How do you choose what modulus $m$ to work in when calculating something this large, or does it matter so long as the $gcd(41,m) = 1$?
I've seen people use $100$ in cases of large numbers and wondering if that is just a standard thing to do or if there is a deeper reasoning behind it. Thanks in advance for the help!
In a comment you reveal that you seek the $\rm\color{#c00}{two}$ least significant digits, so it suffices to compute the integer $\!\bmod 100\,$ since, for example
$$ 54\cdots \color{#c00}{21}\, =\, \overbrace{5\cdot10^5\!+4\cdot10^4\!+\cdots}^{\large \equiv\,\ 0\pmod{\!100}}\, \!+\color{#c00}2\cdot 10+\color{#c00}1\, \equiv\, \color{#c00}{21}\!\!\pmod{\!100}$$
Since the modulus $100 = 4\cdot 25$ we can compute it mod $4$ and mod $25$ and then combine the results by CRT = Chinese Remainder Theorem. Further, if the base shares factors with $100$ then we can factor them out using mod distributivity, often yielding great simplifications, i.e.
note: $ \ ca\bmod cn\:=\: \color{#c00}c\,(a\bmod n)\, =\,$ mod Distributive Law, $ $ so e.g. factoring out $\,\color{#c00}{c=4}\,$ in
$\! \begin{align} 5312^{\large 442}\!\bmod 100\, &=\, \color{#c00}4\,(\color{}{12}^{\large 442}/4\bmod 25)\ \ {\rm by}\,\ 4\mid 12\mid 12^{442} \\ &=\,4\,(\color{}{12}^{\large 2}/\,2^{\large 2}\, \bmod 25)\ \ {\rm by}\,\ 12^{\large 440}\!\equiv (12^{\large\color{#c00}{20}})^{\large 22}\!\equiv 1^{\large 22}\rm \ by\ Euler\ \phi(25)\!=\!\color{#c00}{20}\\ &=\,4\,(6^{\large 2} \bmod 25)\\ &=\, 4\,(11) \end{align}$