(a) Fermat's little theorem states that for any prime [tex]p[/tex], we have
[tex]a^{p-1} \equiv 1 \pmod p[/tex]
for any integer [tex]a[/tex]. Then
[tex]999,999 \equiv 1,000,000 - 1 \equiv 10^6 - 1 \equiv 1 - 1 \equiv 0 \pmod 7[/tex]
so 7 does indeed divide 999,999.
(b) Generalizing, we have
[tex]10^{12n} - 1 \equiv \underbrace{999\ldots999}_{12n \text{ nines}} \equiv (10^n)^{12} - 1 \equiv 0 \pmod {13}[/tex]
for positive integer [tex]n[/tex]. Now, since 1 = 1001 - 1000 and [tex]-1\equiv1000\pmod{1001}[/tex], it follows that [tex]10^3[/tex] is its own inverse modulo 1001, i.e.
[tex]10^3 x \equiv 1\pmod{1001} \implies x = 10^3[/tex]
This means
[tex]10^{12n} \equiv (10^3\times10^3)^{2n} \equiv 1^{2n} \equiv 1\pmod{1001} \\\\ \implies 10^{12n} - 1 \equiv 0 \pmod{1001}[/tex]
which is what we wanted to show.