How to calculate remainder when $15^{43}-3^{23}$ is divided by $14$? I need to calculate the remainder when $15^{43}-3^{23}$ is divided by $14$.
Using what I know already, I got that:
$$15^{43} \equiv 1 \mod 14$$
$$3^{23} \equiv 5 \mod 14$$
and so I should have that 
$$15^{43}-3^{23} \equiv (-4)\bmod14$$ but this is not right so I don't really know what to do, I can't see any error in my calculations?
Any ideas?
 A: Note that $-4 \equiv 10 \mod 14$. 
A: First of all, $15^{43}-3^{23}>0$
So, the reminder will be $\ge0$
You have already found $15^{43}\equiv1\pmod{14}$ 
and as $3^3\equiv-1\pmod{14},3^{23}=3^2(3^3)^7\equiv3^2(-1)^7\equiv-9\pmod{14}$
A: Since $15\equiv1\pmod{14}$, you know that $15^k\equiv1\pmod{14}$ for any (non negative) integer $k$.
Since $\gcd(3,14)=1$, we can apply Euler-Fermat: $\varphi(14)=6$, so $3^6\equiv1\pmod{14}$. Now $23=3\cdot6+5$, so
$$
3^{23}=(3^6)^3\cdot 3^5\equiv 3^5\pmod{14}
$$
Now it's just computation, but if we note that $3\cdot 5\equiv1\pmod{14}$, we have
$$
3^5\equiv 3^5\cdot3\cdot5\equiv 3^6\cdot 5\equiv 5\pmod{14}
$$
Thus
$$
15^{43}-3^{23}\equiv1-5\equiv10\pmod{14}
$$
A: ${\rm mod}\,\ 14\!:\ \ \color{#c00}{15\equiv 1},\ \ \ \color{#0a0}{3^3\equiv -1}$  
$\qquad\ \Rightarrow \ \ \color{#c00}{15}^J- {3^{\large 2} (\color{#0a0}{3^{\large 3}})^{ K}},\ \ \ K$ odd   
$\qquad\ \equiv\quad \color{#c00}1^J - 9\,(\color{#0a0}{-1})^{K}\equiv\, 10\quad $ by $ $ Congruence Arithmetic Rules
