Divisibility by 7.

Rewrite $b$ as

$$a_0 + 10^1a_1 + 10^2 a_2+ \dots+ 10^5 a^5$$

If you worked out $10^0, 10^1, 10^2, \dots, 10^5 \pmod 7$ for $a_0,a_1,\dots,a_5$ respectively, you'll get exactly the required coefficients.


The $10^6 \equiv 1 \pmod 7$ is there to indicate that the coefficients will repeat after every $6$ terms.


As $10^3\equiv-1\pmod7$

$$\sum_{r=0}^{3n-1}(10^{3r}a_{3r}+10^{3r+1}a_{3r+1}+10^{3r+2}a_{3r+2})\equiv\sum_{r=0}^{3n-1}(-1)^ra_{3r}a_{3r+1}a_{3r+2}\pmod7$$


OR

As $7\cdot3-10\cdot2=1,$

Use the reduction formula : $$21x-2(10x+y)\equiv x-2y\pmod7$$ for $10x+y$ recursively