Remainder when dividing $13^{3530}$ with $12348$ [duplicate]

Find the remainder when dividing $13^{3530}$ with $12348$.

How do I solve these type of exercises? I know there's some algorithm for solving them, I just haven't found a concrete example. Could anyone point me in the right direction?

• You need to calculate $13^{3530} \mod 12348$. The easiest algorithm for modular exponentiation is the binary exponentiation, more commonly called "square & multiply". You can find plenty of examples online. Speedhack though: You can reduce the exponent modulo $\phi(12348)$ (Euler-Phi, Euler's Theorem). Through factorizing that number you see that $\phi(12348) = 3528$. Reducing the exponent now only leaves $13^{3530-3528} = 13^2 \mod 12348$ to be computed, which is simply $13^2 = 169$. – Maximilian Gerhardt Jun 16 '16 at 15:53
• Have you tried using Euler's theorem that $a^{\phi(n)} \equiv 1 \mod n$ if $a$ is coprime to $n$? The condition holds, since 13 is no divisor of 12348. Calculating $\phi(12348)$ should make this easy, I think. – HSN Jun 16 '16 at 15:53
• Checkout the previous Questions shown in the Related sidebar on the desktop site. For example, How to find reminder of $m^x$ divided by $n$ using Euler's and Fermat's little theorem – hardmath Jun 16 '16 at 15:55
• Any interested party is welcome to weigh in in the discussion in meta. In particular whether me closing this as a duplicate of the more generic question was appropriate or not. – Jyrki Lahtonen Jun 16 '16 at 16:02
• For the record: I closed this as a duplicate of this generic Q&A. The meta discussion is about whether that was an appropriate thing to do. – Jyrki Lahtonen Jun 16 '16 at 21:41

As $12348=2^23^27^3,$

$13\equiv1\pmod{2^2}\implies13^n\equiv1\ \ \ \ (1)$

$13^3=(1+12)^3\equiv1\pmod{3^2}$

As $3530\equiv2\pmod3,13^{3530}\equiv13^2\pmod9\equiv7\ \ \ \ (2)$

Now $\phi(7^3)=7^2(7-1)$ and $3530\equiv2\pmod{7^2(7-1)}$ $\implies13^{3530}\equiv13^2\pmod{7^3}\equiv169\ \ \ \ (3)$

Now apply CRT on $(1),(2),(3)$

Alternatively, using Carmichael function, $$\lambda(2^23^27^3)=294$$ and $$3530\equiv2\pmod{294}$$

$$\implies13^{3530}\equiv13^2\pmod{2^23^27^3}$$