Answer:
(a) Fermat's little theorem states that for any prime p , we have
a^p-1 = 1 (mod p).
for any integer ,a. Then
999999 = 1000000 - 1 = 10^6 - 1 = 1 - 1 = 0 (mod 7)
so 7 does indeed divide 999,999.
(b) Generalizing, we have
10^12n - 1 = 999...999 (12n nines) = (10^n)^12 - 1 = 0 (mod 13)
for positive integer, n. Now, since 1 = 1001 - 1000 and -1 = (mod 1001) , it follows that 10^3 is its own inverse modulo 1001, i.e.
10^3 x = 1 (mod 1001) -----> x = 10^3
This means
10^12n = (10^3 x 10^3)^2n = 1^2n = 1 (mod 1001) ----> 10^12n - 1 = 0 (mod 1001)