I'm unsure how to compute the following : 3^1000 (mod13)
I tried working through an example below,
ie) Compute $3^{100,000} \bmod 7$ $$ 3^{100,000}=3^{(16,666⋅6+4)}=(3^6)^{16,666}*3^4=1^{16,666}*9^2=2^2=4 \pmod 7\\ $$
but I don't understand why they divide 100,000 by 6 to get 16,666. Where did 6 come from?
Fermat's Little Theorem says that: $$a^p \equiv a\pmod{p}$$ Or, that: $$a^{p-1}\equiv 1\pmod{p}$$ You're looking at this mod $7$, so $3^{7-1} = 3^6\equiv 1\pmod{p}$. So, we're trying to split $100,000$ into $6k+r$ where $0\leq r < 5$, which is what writing $100,000 = 16,666\times 6+4$.