Why multiplication of 142857 with 2,3,4,5,6 gives the same digits shifted? I was reading about a not so practical way to determine the divisibility of a number by $7$.
At some point the following number is mentioned: $142857$ (which is the result of $\frac{999999}{7}$) and apparently this number as I have verified if multiplied by $2,3,4,5, 6$ it gives the same digits in different order e.g. $142857 \cdot 3 = 428571$
Why does this number have this property? I see that the numbers $2,3,4,5,6$ are all remainders if we divide $100, 10, 10000, 100000, 1000$ by $7$ respectively but I am not sure if there is any correlation with the property.
I'd like to understand the intuition behind this "trick"
Note: I have found a similar post but I don't see any explanation on this
 A: Well, one can note that $142857$ is a bit of a special number in that $\frac{1}{7}=0.\overline{142857}$, which means that, by long division, one obtains $\overline{142857}=142857142857142857...$ ad infinitum via the following algorithm:
Start with $1$.
$1=\color{green}{0}\times7+\color{red}{1}$ so $\frac{1}{7}=0.\text{something}$
To get this something, do:
$\color{red}{1}\times10 = 10 = \color{green}{1}\times7+\color{red}{3}$ (*)
$\color{red}{3}\times10 = 30 = \color{green}{4}\times7+\color{red}{2}$ (**)
$\color{red}{2}\times10 = 20 = \color{green}{2}\times7+\color{red}{6}$
$\color{red}{6}\times10 = 60 = \color{green}{8}\times7+\color{red}{4}$
$\color{red}{4}\times10 = 40 = \color{green}{5}\times7+\color{red}{5}$
$\color{red}{5}\times10 = 50 = \color{green}{7}\times7+\color{red}{1}$
Now, the remainder is $\color{red}{1}$, which is what we started with at equation (*), so we now have a loop which yields $\frac{1}{7}=0.\color{green}{\overline{142857}}$. In group-theoretic parlance, the fact that the loop closes after $6$ iterations means that $10$ has order $6$ in $(\mathbb{Z}/7\mathbb{Z})^*$, i.e. $10^6\equiv1 \pmod{7}$ and $10^k\neq1\pmod7$ for $1 \leq k \leq 5$.
To understand why the digits are shifted when e.g. multiplying by $3$, just note that multiplying $\frac{1}{7}$ by $3$ means considering $\frac{3}{7}$ instead of $\frac{1}{7}$, and so the algorithm would start at equation (**) instead of (*), thus yielding $\color{green}{\overline{428571}}$ instead of $\color{green}{\overline{142857}}$.
So $\frac{3}{7}=\frac{3\times 142857}{999999} = \frac{428571}{999999} \Rightarrow 3\times142857 = 428571$
This explains the shift.
