how to calculate $2^{5000}$ mod 10 without calculator in fast way?
Consider the first few powers of 2:


  1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024…


Now take all of those mod 10:


  1, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4…


Try to solve it yourself, from this, before continuing to read.



There's a theorem that says, if $x \times y \cong z \mod m$, then $x' \times y \cong z \mod m$, for any $x' \cong x \mod m$. This means that, if you ever find two powers of two that are congruent (mod 10), the values in between them will form a cycle that loops forever. And it'll always be possible to find such congruent powers, so there'll always be such a cycle with ten or fewer elements in it. (All three of these statements can and should be proven, but those proofs are left as an exercise for the reader.)

In this case, the first such pair of values are 2 and 32. In other words, $2^5 \cong 2^1 \mod 10$. Which means that $2^6 \cong 2^2 \mod 10$, and $2^7 \cong 2^3 \mod 10$, and so on. In general, $2^x \cong 2^y \mod 10$ iff $x \cong y \mod 4$ (for integers $x, y \geq 1$).

So all you have to do now is reduce 5000 mod 4; since we know that $100 \cong 0 \mod 4$, 5000 must also be congruent to zero (and, more relevantly, to four, since our formula only holds for integers ≥ 1—do you see why?). Therefore, $2^{5000} \cong 2^4 \mod 10$. Now you just need to know the first few powers of two, or multiply them out longhand, to find that the answer is $2^{5000} \cong 2^4 \cong 6$.