<s>[INST] 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
 [/INST] $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.   
</s>