1

I am having trouble computing $12^{15}$ mod $2016$ due to the large size of the modulus. I need to do this and list the steps out by hand

OLE
  • 602
John
  • 13
  • 2
    Hint $12^{15} \equiv x \mod 2016$ means $x + 2016k = 12^{15}$ so $x/288 + 7k = 3^{13}2^{10}$ so it's a matter of solving $3^{13}2^{10}\equiv y \mod 7$ and then $x = 288*y$ – fleablood Dec 14 '16 at 00:10
  • 1
    You can also use the chinese remainder theorem. We have $2016=32\cdot 9\cdot 7$ , so if you know the residues modulo $32,9$ and $7$, you can calculate the residue modulo $2016$ – Peter Dec 14 '16 at 00:21
  • @Peter In cases like this CRT is overkill, and often involves much extra effort (e.g. unneeded inverse computations). See my comment on my answer for more. – Bill Dubuque Dec 14 '16 at 22:14
  • @BillDubuque Overkill ? The remainders modulo $32$ and $9$ are $0$ (can be seen immediately), so the solution must be a multiple of $288$. The remainder modulo $7$ is $6$ (this is easy as well, the reduction becomes $(-2)^3=-8\equiv 6$) , whereas the remainder of $288$ modulo $7$ is $1$. So we have the solution $288\cdot 6=1728$ without much effort. I agree that CRT is an overkill in some cases, but not here – Peter Dec 15 '16 at 14:00
  • @Peter I explained this in the comments I referenced. Indeed, if you know how to intelligently optimize CRT then it is not too much more work to use CRT. But if not (e.g. most students) then you end up needlessly computing inverses, and this will be more work (much more so for larger numbers). In cases like this it is almost always simpler to eliminate any need for CRT by pulling out the common factor $,c,,$ i.e. using $\ ca\bmod cn,=, c(a\bmod n),\ $ as I explained in my answer. – Bill Dubuque Dec 15 '16 at 14:10

2 Answers2

0

Remember $a \equiv b \mod n$ means $\frac a{\gcd(a,n)} \equiv \frac b{\gcd(a,n)} \mod \frac n{\gcd(a,n)}$.

Proof: $a \equiv b \mod n \implies a + nk = b \implies \gcd(a,n)(\frac a{\gcd(a,n)} + \frac n{\gcd(a,n)}k \implies \frac a{\gcd(a,n)} \equiv \frac b{\gcd(a,n)} \mod \frac n{\gcd(a,n)}$

$2016 = 7*2^53^2$ so $\gcd(2016, 12^{15}) = 2^53^2$

So $12^{15} \equiv x \mod 2016 \implies 2^{25}3^{13} \equiv x/288 \mod 7$

$2^6 \equiv 3^6 \equiv 1 \mod 7$ by Fermat's Little Theorem so

$2^{25}3^{13}\equiv 2*3 \equiv 6 \equiv -1 \mod 7$.

So $x = -288$.

So $12^{15} \equiv -288 \mod 2016$

fleablood
  • 124,253
0

Applying $\, ca \bmod cn\, =\, c(a\bmod n)\,\, $ the mod Distributive Law, we get

$\,\ \ \ \begin{align} 12^{\large 15}\!\bmod {288\cdot 7}\, &=\, 288\,( 12^{\large 15}/288\,\bmod 7)\ \ {\rm by}\ \ 288 = 2^{\large 5}\cdot 3^{\large 2}\mid 12^{\large 15}\\ &=\, 288\,(\color{#c00}{(-2)^{\large 15}}/1\, \bmod 7)\\ &=\, 288\,(\ \color{#c00}6\, \bmod 7)\ \ {\rm by}\ \ 2^{\large 3}\equiv 1\,\Rightarrow\,\color{#c00}{(-2)^{\large 15}\!\equiv -1\equiv 6}\!\!\!\!\pmod{\! 7}\\ &=\, 1728 \end{align}$

Bill Dubuque
  • 272,048
  • Yeah, we are both obliquely but not explicitely referencing the chinese remainder theoren as peter bought up int the comments. $12^{15} \equiv 0 \mod 32; \equiv 0 \mod 9$ and $\equiv 6 \mod 7$. so $2^{15} \equiv k 288=6 + 7j$. Since $288 \equiv 1 \mod 7$ then $k288 \equiv k \mod 7$ so $k =6$ and $2^{15} \equiv 6*288 \mod 2016$. – fleablood Dec 14 '16 at 19:46
  • @fleablood I purposely do not use CRT since it is overkill here. If you mechanically apply the most common form of CRT to solve $, x\equiv 0\pmod c,, x\equiv ca\pmod n,$ then it requires computing $,c^{-1}\bmod n.,$ That's not too hard in this special case, but it can be much more difficult for larger $,c,n.,$ Factoring out $,c,$ as above completely avoids inverse calculations. It is possible to optimize most versions of CRT to avoid the spurious inverse computations in cases like this. But most students are not familiar with such optimizations. – Bill Dubuque Dec 14 '16 at 22:05
  • I agree. This seemed a case of simplify first and see what happens. Mod 7 was makes the whole thing simple. – fleablood Dec 14 '16 at 22:18
  • @fleablood Here is a an example of such spurious CRT inversion. Contrast that with my answer there (as above). But again the numbers are so small that the inversion is not as painful as it would be with larger numbers. But it is still more work. – Bill Dubuque Dec 15 '16 at 03:23
  • @fleablood I just added a slightly more general explanation in this answer. Hopefully the ideas aren't lost in the calculations. – Bill Dubuque Dec 15 '16 at 18:26
  • @fleablood I simplified it even further, to make the relationship clearer. – Bill Dubuque Jan 31 '17 at 21:27