<s>[INST] Find the least positive residue of $10^{515}\pmod 7$. I tried it, but being a big number unable to calculate it.
 [/INST] All answers here use Fermat's little theorem, which is cool, but there is another simpler way (simpler if you don't know Fermat's theorem, otherwise it's more complicated).
$$10^0\equiv 1\mod 7\\
10^1 \equiv 3\mod 7\\
10^2\equiv 10\cdot 10 \equiv 3\cdot 3\equiv 9\equiv 2\mod 7\\
10^3 \equiv 10\cdot 10^2\equiv 3\cdot 2\equiv 6\mod 7\\
10^4\equiv 10\cdot 10^3\equiv 3\cdot 6\equiv 18\equiv 4\mod7\\
10^5\equiv 10\cdot 10^4\equiv 3\cdot 4 \equiv 12\equiv 5\mod 7\\
10^6\equiv 10\cdot 10^5\equiv 3\cdot 5\equiv 15\equiv 1\mod 7$$
Therefore, you know that taking $10^n\mod 7$ will result in a sequence which has repeating values: $1,3,2,6,4,5$, i.e. every sixth (so the zeroth, sixth, twelfth,...) number is $1$. Since $510=6\cdot 85$, you know that the $510$-th number in the sequence will again be $1$, then $511$-th $3$ and so on, so the $515$-th will be $5$.
</s>