Remainder when $27^{40}$ is divided by $12$ What is the remainder when ${27}^{40}$ is divided by $12$ ?
The answer is supposed by $9$ but i’m getting it’s as $3$ . Please correct me in my approach to the problem. 
This is how I did it :- 
${27}^{40} = {(3^3)}^{40} = {3}^{120}$
$\frac{{3}^{120}}{12} = \frac{3^{119}}{4}$
Thus 
$\frac{{3}^{119}}{4} = \frac{(3^{4})^{29}3^3}{4}$
We can now expand ${81}^{29}$ by binomial theorem
$27(\binom{29}{0}(80)^{29} + \binom{29}{1}(80)^{28} + \binom{29}{2}(80)^{27}......+\binom{29}{29}1)$ 
As all the numbers is the parentheses except $\binom{29}{29}$ are multiples of $4$ we can remove it out of the parentheses
Thus we will have , 
$27(4K) + 27$ 
$4m + 4(6) +3$
$4n +3$
Where $k,m,n$ will be multiple of $4$ this gives remainder as 3
Please help me find the flaw . Thank you
 A: Everything you did so far is right.
To finish off, you have
$$
\frac{3^{120}}{12} = \frac{3^{119}}{4} = \frac{4n+3}{4} = n + \frac{3}{4} $$
where $n$ is an integer. Now note that 
$$
n + \frac{3}{4} = n + \frac{9}{12}$$
and you see the remainder is $9$.
A: Here is your flaw: You can't simplify a fraction when you're looking for a remainder. For instance, the remainder when $15$ is divided by $10$ is $5$, but when $3$ is divided by $2$ you get $1$. So don't do the transition from $\frac{3^{120}}{12}$ to $\frac{3^{119}}{4}$ unless you take some care to remember that you did it, and knowing how it affects the result.
One way to correct for it is, as others have pointed out, to convert from $\frac{}{4}$ to $\frac{}{12}$ after you're done taking away all the whole numbers that the division results in (in other words, once you've found that the fractional part of the division is $.75$).
A: $27(4K) + 27$ is the numerator in your fraction $\frac{(3^{4})^{29}3^3}{4}$. Did you forget about the $4$ in the denominator? Here is another approach to solve the problem. The remainder of 27 in dividing by $12$ is $3.$ Thus the remainder of $27^{40}$ is the same as the remainder of $3^{40}$ which is $3(27^{13}).$ Replacing 27 by its remainder 3 we get to $3(3^{13})$ which is $3^{14}= 9(27^4)$. Replacing 27 by 3 we get to $9(3^4)=3^6=27^2$ Replacing $27$ by $3$ and we get the correct answer which is 9.   
