Find the least positive residue of $10^{515}\pmod 7$. I tried it, but being a big number unable to calculate it.
 A: $10^{6} \equiv 1 $ mod $7$ By Fermat's little theorem.  Notice $515=6 \times 85+5$ so $10^{515} \equiv 10^{5}$ mod $7$. Notice $10 \equiv 3$ mod 7, so $10^{2} \equiv 3^{2} \equiv 2$ and $10^{3} \equiv 20 \equiv -1\equiv 6$ mod $7$, $10^{4} \equiv 60 \equiv 4$ mod $7$, so $10^{5} \equiv 40 \equiv 5$ mod $7$. So $10^{515}\equiv 5$ mod $7$
A: $$10^{515}\equiv 3^{515}\equiv 3^{515\pmod{6}}\equiv 3^{5}\equiv\color{red}{5}\pmod{7}$$ by Fermat's little theorem.
A: 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$.
A: $10^{12} \equiv -1 \mod{7}$
$10^{11} \equiv 5 \mod{7}$
$10^{515} = (10^{12})^{42} \times10^{11} \equiv (-1)^{42} \times5 \mod{7} \equiv 5 \mod{7}$
